//javascript:(function (){
	function logit(msg){
		setTimeout(function(){
			throw new Error(msg);
		}, 0);
	}
	
	var restartInterval;
	var runTimeInterval;
	var SkillSpendingInProgress = false;
	var pointsToSpend = 0;
	
	var NYJobMap = {
		D1:[
			{isName: "Perform a Hit (1.200)", isJobID: 37, isTab: 1, isCity: 1},
			{isName: "Grow Your Family (1.250)", isJobID: 8, isTab: 1, isCity: 1},
			{isName: "Collect Protection Money (1.333)", isJobID: 5, isTab: 1, isCity: 1},
			{isName: "Rob the Warehouse (1.000)", isJobID: 4, isTab: 1, isCity: 1},
			{isName: "Rough Up Dealers (1.000)", isJobID: 3, isTab: 1, isCity: 1},
			{isName: "Rob a Drug Runner (1.000)", isJobID: 2, isTab: 1, isCity: 1},
			{isName: "Chase Away Thugs (1.000)", isJobID: 1, isTab: 1, isCity: 1}
		],
		D2:[
			{isName: "Mugging (1.0000)", isJobID: 6, isTab: 2, isCity: 1},
			{isName: "Auto Theft (1.3333)", isJobID: 7, isTab: 2, isCity: 1},
			{isName: "Take Out a Rogue Cop (1.3333)", isJobID: 9, isTab: 2, isCity: 1},
			{isName: "Collect on a Loan (1.2500)", isJobID: 10, isTab: 2, isCity: 1},
			{isName: "Bank Heist (1.6667)", isJobID: 11, isTab: 2, isCity: 1},
			{isName: "Jewelry Store Job (1.7143)", isJobID: 12, isTab: 2, isCity: 1},
			{isName: "Hijack a Semi (1.7143)", isJobID: 38, isTab: 2, isCity: 1}
		],	
		D3:[
			{isName: "Destroy Enemy Mob Hideout (1.2000)", isJobID: 13, isTab: 3, isCity: 1},
			{isName: "Kill a Protected Snitch (1.2000)", isJobID: 14, isTab: 3, isCity: 1},
			{isName: "Bust a Made Man Out of Prison (1.2000)", isJobID: 15, isTab: 3, isCity: 1},
			{isName: "Asian Museum Break-in (1.3333)", isJobID: 16, isTab: 3, isCity: 1},
			{isName: "Fight a Haitian Gang (1.6000)", isJobID: 17, isTab: 3, isCity: 1},
			{isName: "Clip the Irish Mob's Local Enforcer (1.4444)", isJobID: 39, isTab: 3, isCity: 1},
			{isName: "Steal a Tanker Truck (1.2857)", isJobID: 40, isTab: 3, isCity: 1}
		],
		D4:[
			{isName: "Federal Reserve Raid (1.5909)", isJobID: 18, isTab: 4, isCity: 1},
			{isName: "Smuggle Thai Gems (1.5625)", isJobID: 19, isTab: 4, isCity: 1},
			{isName: "Liquor Smuggling (1.4815)", isJobID: 22, isTab: 4, isCity: 1},
			{isName: "Run Illegal Poker Game (2.1111)", isJobID: 26, isTab: 4, isCity: 1},
			{isName: "Wiretap the Cops (1.8889)", isJobID: 28, isTab: 4, isCity: 1},
			{isName: "Rob an Electronics Store (1.4286)", isJobID: 41, isTab: 4, isCity: 1},
			{isName: "Burn Down a Tenement (1.5625)", isJobID: 42, isTab: 4, isCity: 1},
			{isName: "Distill Some Liquor (1.5556)", isJobID: 23, isTab: 4, isCity: 1},
			{isName: "Manufacture Tokens (1.5556)", isJobID: 24, isTab: 4, isCity: 1},
			{isName: "Get Cheating Deck (1.5556)", isJobID: 25, isTab: 4, isCity: 1},
			{isName: "Overtake Phone Central (1.5556)", isJobID: 27, isTab: 4, isCity: 1}
		],
		D5:[
			{isName: "Repel the Yakuza (1.8182)", isJobID: 29, isTab: 5, isCity: 1},
			{isName: "Disrupt Rival Smuggling Ring (1.7692)", isJobID: 30, isTab: 5, isCity: 1},
			{isName: "Invade Tong-controlled Neighborhood (1.5909)", isJobID: 31, isTab: 5, isCity: 1},
			{isName: "Sell Guns to the Russian Mob (1.8182)", isJobID: 32, isTab: 5, isCity: 1},
			{isName: "Protect your City against a Rival Family (1.8710)", isJobID: 33, isTab: 5, isCity: 1},
			{isName: "Assassinate a Political Figure (1.8710)", isJobID: 34, isTab: 5, isCity: 1},
			{isName: "Exterminate a Rival Family (1.8611)", isJobID: 35, isTab: 5, isCity: 1},
			{isName: "Obtain Compromising Photos (1.4800)", isJobID: 43, isTab: 5, isCity: 1},
			{isName: "Frame a Rival Capo (1.6522)", isJobID: 44, isTab: 5, isCity: 1}
		],
		D6:[
			{isName: "Steal an Air Freight Delivery (1.4643)", isJobID: 45, isTab: 6, isCity: 1},
			{isName: "Run a Biker Gang Out of Town (1.4839)", isJobID: 46, isTab: 6, isCity: 1},
			{isName: "Flip a Snitch (1.5909)", isJobID: 47, isTab: 6, isCity: 1},
			{isName: "Steal Bank Records (1.5185)", isJobID: 48, isTab: 6, isCity: 1},
			{isName: "Loot the Police Impound Lot (1.2778)", isJobID: 49, isTab: 6, isCity: 1},
			{isName: "Recruit a Rival Crew Member (1.6667)", isJobID: 50, isTab: 6, isCity: 1},
			{isName: "Dodge an FBI Tail (1.6667)", isJobID: 51, isTab: 6, isCity: 1},
			{isName: "Whack a Rival Crew Leader (1.7600)", isJobID: 52, isTab: 6, isCity: 1}
		],
		D7:[
			{isName: "Influence a Harbor Official (1.6444)", isJobID: 53, isTab: 7, isCity: 1},
			{isName: "Move Stolen Merchandise (1.8125)", isJobID: 54, isTab: 7, isCity: 1},
			{isName: "Snuff a Rat (1.8205)", isJobID: 55, isTab: 7, isCity: 1},
			{isName: "Help a Fugitive Flee the Country (1.8333)", isJobID: 56, isTab: 7, isCity: 1},
			{isName: "Dispose of a Body (1.8636)", isJobID: 57, isTab: 7, isCity: 1},
			{isName: "Ransom a Businessman's Kids (1.5000)", isJobID: 58, isTab: 7, isCity: 1},
			{isName: "Fix the Big Game (1.5333)", isJobID: 59, isTab: 7, isCity: 1},
			{isName: "Steal an Arms Shipment (1.8750)", isJobID: 60, isTab: 7, isCity: 1}
		],
		D8:[
			{isName: "Extort a Corrupt Judge (1.9524)", isJobID: 61, isTab: 8, isCity: 1},
			{isName: "Embezzle Funds Through a Phony Company (1.8000)", isJobID: 62, isTab: 8, isCity: 1},
			{isName: "Break Into the Armory (1.5333)", isJobID: 63, isTab: 8, isCity: 1},
			{isName: "Rip Off the Armenian Mob (1.7333)", isJobID: 64, isTab: 8, isCity: 1},
			{isName: "Muscle in on a Triad Operation (1.9500)", isJobID: 65, isTab: 8, isCity: 1},
			{isName: "Ambush a Rival at a Sit Down (1.8776)", isJobID: 66, isTab: 8, isCity: 1},
			{isName: "Order a Hit on a Public Official (2.0323)", isJobID: 67, isTab: 8, isCity: 1},
			{isName: "Take Over an Identity Theft Ring (1.8750)", isJobID: 68, isTab: 8, isCity: 1}
		],
		D9:[
			{isName: "Settle a Beef... Permanently (1.9167)", isJobID: 69, isTab: 9, isCity: 1},
			{isName: "Buy Off a Federal Agent (2.1613)", isJobID: 70, isTab: 9, isCity: 1},
			{isName: "Make a Deal with the Mexican Cartel (1.9167)", isJobID: 71, isTab: 9, isCity: 1},
			{isName: "Blackmail the District Attorney (1.8974)", isJobID: 72, isTab: 9, isCity: 1},
			{isName: "Shake Down a City Council Member (2.0000)", isJobID: 73, isTab: 9, isCity: 1},
			{isName: "Make Arrangements for a Visiting Don (1.9167)", isJobID: 74, isTab: 9, isCity: 1},
			{isName: "Take Control of a Casino (1.9206)", isJobID: 75, isTab: 9, isCity: 1},
			{isName: "Travel to the Old Country (1.9565)", isJobID: 76, isTab: 9, isCity: 1}
		]
	};
	
	var BRLJobMap = {
		D1:[
			{isName: "Scope Out the Financial District (1.152)", isJobID: 1, isTab: 1, isCity: 7},
			{isName: "Set Up Your Operation in a Renovated Skyscraper (1.152)", isJobID: 2, isTab: 1, isCity: 7},
			{isName: "Ask an Informant About Local Crime Activity (1.163)", isJobID: 3, isTab: 1, isCity: 7},
			{isName: "Steal Artwork from the Paco Imperial (1.531)", isJobID: 4, isTab: 1, isCity: 7},
			{isName: "Bribe a Corporate Executive (1.152)", isJobID: 5, isTab: 1, isCity: 7},
			{isName: "Ambush a Group of Neo-Imperium (1.531)", isJobID: 6, isTab: 1, isCity: 7},
			{isName: "Destroy a Bondinho Tram (1.136)", isJobID: 7, isTab: 1, isCity: 7},
			{isName: "Blackmail a Cathedral Representative (1.146)", isJobID: 8, isTab: 1, isCity: 7},
			{isName: "Run a Collection Plate Con (1.378)", isJobID: 9, isTab: 1, isCity: 7},
			{isName: "Track Down Lieutenant Sandoval (1.598)", isJobID: 10, isTab: 1, isCity: 7},
			{isName: "Assassinate a Politician at a Museum Gala (1.47)", isJobID: 11, isTab: 1, isCity: 7}
		],
		D2:[
			{isName: "Meet a Contact at Mosqueiro (1.47)", isJobID: 13, isTab: 2, isCity: 7},
			{isName: "Impersonate a Wealthy Entrepreneur (1.47)", isJobID: 14, isTab: 2, isCity: 7},
			{isName: "Dispose of a Police Chief (1.705)", isJobID: 15, isTab: 2, isCity: 7},
			{isName: "Intimidate the Local Crime Ring (1.957)", isJobID: 16, isTab: 2, isCity: 7},
			{isName: "Track Down Neo-Imperium Members (1.705)", isJobID: 17, isTab: 2, isCity: 7},
			{isName: "Smuggle a Shipment Through Aeroporto de Belem (1.649)", isJobID: 18, isTab: 2, isCity: 7},
			{isName: "Steal the Plans (1.77)", isJobID: 19, isTab: 2, isCity: 7},
			{isName: "Burn Down a Jungle Hideout (1.899)", isJobID: 20, isTab: 2, isCity: 7},
			{isName: "Establish a Spy Ring of Belem Fishermen (1.818)", isJobID: 21, isTab: 2, isCity: 7},
			{isName: "Gun Down Kidnappers (2.027)", isJobID: 22, isTab: 2, isCity: 7},
			{isName: "Capture a Neo-Imperium Captain (1.862)", isJobID: 23, isTab: 2, isCity: 7},
			{isName: "Bribe a City Official (1.862)", isJobID: 24, isTab: 2, isCity: 7}
		],
		D3:[
			{isName: "Blackmail a City Official (1.7)", isJobID: 25, isTab: 3, isCity: 7},
			{isName: "Gather Intel from Street Rats (1.572)", isJobID: 26, isTab: 3, isCity: 7},
			{isName: "Assassinate a Neo-Imperium Spokesman (1.619)", isJobID: 27, isTab: 3, isCity: 7},
			{isName: "Bribe a Police Commandant (1.661)", isJobID: 28, isTab: 3, isCity: 7},
			{isName: "Pilfer from a Rebel Supply House (1.619)", isJobID: 29, isTab: 3, isCity: 7},
			{isName: "Locate a Rebel Outpost (1.665)", isJobID: 30, isTab: 3, isCity: 7},
			{isName: "Intercept a Rebel Convoy (1.742)", isJobID: 31, isTab: 3, isCity: 7},
			{isName: "Take Out a Rebel Lookout (1.631)", isJobID: 32, isTab: 3, isCity: 7},
			{isName: "Create a Diversion in the Jungle (1.67)", isJobID: 33, isTab: 3, isCity: 7},
			{isName: "Blow Up a Munitions Dump (1.602)", isJobID: 34, isTab: 3, isCity: 7},
			{isName: "Open Fire on Rebel Fighters (1.701)", isJobID: 35, isTab: 3, isCity: 7},
			{isName: "Rescue a Hostage (1.637)", isJobID: 36, isTab: 3, isCity: 7}
		],
		D4:[
			{isName: "Move to a Sao Paolo Safe House (1.702)", isJobID: 37, isTab: 4, isCity: 7},
			{isName: "Transport a Drug Shipment (1.731)", isJobID: 38, isTab: 4, isCity: 7},
			{isName: "Push Over a Gun Runner (1.827)", isJobID: 39, isTab: 4, isCity: 7},
			{isName: "Pass Along a Bribe (1.757)", isJobID: 40, isTab: 4, isCity: 7},
			{isName: "Contact a Comando do Candiru Agent (1.87)", isJobID: 41, isTab: 4, isCity: 7},
			{isName: "Scout Out the City (1.781)", isJobID: 42, isTab: 4, isCity: 7},
			{isName: "Rob a Jewelry Store (1.889)", isJobID: 43, isTab: 4, isCity: 7},
			{isName: "Burn Down a Slum Building (1.907)", isJobID: 44, isTab: 4, isCity: 7},
			{isName: "Escape a Police Pursuit (1.824)", isJobID: 45, isTab: 4, isCity: 7},
			{isName: "Demolish a Rooftop Helipad (1.855)", isJobID: 46, isTab: 4, isCity: 7},
			{isName: "Wipe Out a Favela Street Gang (1.873)", isJobID: 47, isTab: 4, isCity: 7},
			{isName: "Interrogate a Neo-Imperium Supporter (1.889)", isJobID: 48, isTab: 4, isCity: 7}
		],
		D5:[
			{isName: "Smuggle Weapons Down the River to a Recife Port (1.843)", isJobID: 49, isTab: 5, isCity: 7},
			{isName: "Negotiate a Sit-Down with the Comando do Candiru (1.813)", isJobID: 50, isTab: 5, isCity: 7},
			{isName: "Auction Off a Rival's Private Island (1.788)", isJobID: 51, isTab: 5, isCity: 7},
			{isName: "Detonate an Ethanol Shipment (1.859)", isJobID: 52, isTab: 5, isCity: 7},
			{isName: "Create a Shark Scare (1.832)", isJobID: 53, isTab: 5, isCity: 7},
			{isName: "Steal Confidential Medical Records (1.937)", isJobID: 54, isTab: 5, isCity: 7},
			{isName: "Blackmail a University Instructor (1.996)", isJobID: 55, isTab: 5, isCity: 7},
			{isName: "Raid a Biochemist's Lab (1.962)", isJobID: 56, isTab: 5, isCity: 7},
			{isName: "Sink a Cargo Ship in Port (1.764)", isJobID: 57, isTab: 5, isCity: 7},
			{isName: "Take Over a Shipyard (1.943)", isJobID: 58, isTab: 5, isCity: 7},
			{isName: "Give Chase to the Neo-Imperium (1.984)", isJobID: 59, isTab: 5, isCity: 7}
		],
		D6:[
			{isName: "Shake Down Some Locals For Information (2.006)", isJobID: 60, isTab: 6, isCity: 7},
			{isName: "Discover Connections to Local Gangs (2.021)", isJobID: 61, isTab: 6, isCity: 7},
			{isName: "Bribe a News Network Executive (2.061)", isJobID: 62, isTab: 6, isCity: 7},
			{isName: "Make an Announcement on a Local TV Network (1.905)", isJobID: 63, isTab: 6, isCity: 7},
			{isName: "Convince The Locals Of Your Good Intentions (2.01)", isJobID: 64, isTab: 6, isCity: 7},
			{isName: "Hunt Down The Revolucao Vermelho's Affiliates (1.937)", isJobID: 65, isTab: 6, isCity: 7},
			{isName: "Bust Up a Local Drug Ring (1.971)", isJobID: 66, isTab: 6, isCity: 7},
			{isName: "Delay a Police Patrol (2.04)", isJobID: 67, isTab: 6, isCity: 7},
			{isName: "Hijack a Fuel Truck (1.971)", isJobID: 68, isTab: 6, isCity: 7},
			{isName: "Offer Protection to a Franchise Business (1.996)", isJobID: 69, isTab: 6, isCity: 7},
			{isName: "Execute a Slum Gang Leader (2.086)", isJobID: 70, isTab: 6, isCity: 7},
			{isName: "Make a Direct Assault on the RV Base (2.099)", isJobID: 71, isTab: 6, isCity: 7}
		],
		D7:[
			{isName: "Mobilize Your Operation (2.006)", isJobID: 72, isTab: 7, isCity: 7},
			{isName: "Generate Revenue for Your Cause (2.079)", isJobID: 73, isTab: 7, isCity: 7},
			{isName: "Find Proof of Police Corruption (2.04)", isJobID: 74, isTab: 7, isCity: 7},
			{isName: "Rendezvous with Comando do Candiru Agents (2.079)", isJobID: 75, isTab: 7, isCity: 7},
			{isName: "Bribe a Carnival Director (2.079)", isJobID: 76, isTab: 7, isCity: 7},
			{isName: "Take Advantage of a Distracted Crowd (2.04)", isJobID: 77, isTab: 7, isCity: 7},
			{isName: "Blend in with a Group of Float Performers (2.015)", isJobID: 78, isTab: 7, isCity: 7},
			{isName: "Assassinate the Guest of Honor (2.058)", isJobID: 79, isTab: 7, isCity: 7},
			{isName: "Cut the RV's Purse Strings (2.006)", isJobID: 80, isTab: 7, isCity: 7},
			{isName: "Tail a Group of RV to Their Base (2.04)", isJobID: 81, isTab: 7, isCity: 7},
			{isName: "Remove the Police Protection (2.015)", isJobID: 82, isTab: 7, isCity: 7},
			{isName: "Demolish an RV stronghold (2.065)", isJobID: 83, isTab: 7, isCity: 7}
		],
		D8:[
			{isName: "Prepare an Ambush for a Neo-Imperium Sect (2.015)", isJobID: 84, isTab: 8, isCity: 7},
			{isName: "Interrogate Comando do Condiru Agents (2.05)", isJobID: 85, isTab: 8, isCity: 7},
			{isName: "Acquire Funds for Taubate Operations (2.086)", isJobID: 86, isTab: 8, isCity: 7},
			{isName: "Bribe a Taubate Prison Worker (2.221)", isJobID: 87, isTab: 8, isCity: 7},
			{isName: "Infiltrate Taubate Prison (2.05)", isJobID: 88, isTab: 8, isCity: 7},
			{isName: "Arrange for Prisoner Transfers (1.974)", isJobID: 89, isTab: 8, isCity: 7},
			{isName: "Disable Police Emergency Response (2.04)", isJobID: 90, isTab: 8, isCity: 7},
			{isName: "Cause Civilian Panic (2.099)", isJobID: 91, isTab: 8, isCity: 7},
			{isName: "Scout For Potential (2.065)", isJobID: 92, isTab: 8, isCity: 7},
			{isName: "Break Mafia Members Out of Taubate (2.024)", isJobID: 93, isTab: 8, isCity: 7},
			{isName: "Destroy the Neo-Imperium's Cover Operations (2.072)", isJobID: 94, isTab: 8, isCity: 7},
			{isName: "Assassinate the Neo-Imperium's Primary Heads (2.191)", isJobID: 95, isTab: 8, isCity: 7}
		]
	};

	var CHIJobMap = {
		D1:[
			{isName: "Meet With the South Gang Family (1.333)", isJobID: 1, isTab: 1, isCity: 8},
			{isName: "Drive North of the Border (1.333)", isJobID: 2, isTab: 1, isCity: 8},
			{isName: "Set Up a Rum Running Operation (1.25)", isJobID: 3, isTab: 1, isCity: 8},
			{isName: "Smuggle a Shipment Back to Chicago (1.75)", isJobID: 4, isTab: 1, isCity: 8},
			{isName: "Break Into Guido Pantucci's Warehouse (1.25)", isJobID: 5, isTab: 1, isCity: 8},
			{isName: "Dodge the Guards (1.75)", isJobID: 6, isTab: 1, isCity: 8},
			{isName: "Get Rid of Pantucci (1.167)", isJobID: 7, isTab: 1, isCity: 8},
			{isName: "Dispose of the Bodies (1.333)", isJobID: 8, isTab: 1, isCity: 8}
		],
		D2:[
			{isName: "Run an illegal Establishment (1.933)", isJobID: 9, isTab: 2, isCity: 8},
			{isName: "Secure Hooch to Sell in Your Joint (2.167)", isJobID: 10, isTab: 2, isCity: 8},
			{isName: "Recruit Loyal Gunmen (1.611)", isJobID: 11, isTab: 2, isCity: 8},
			{isName: "Case Warehouses on the North Side (2.143)", isJobID: 12, isTab: 2, isCity: 8},
			{isName: "Expose a Treachery in Your Family (1.625)", isJobID: 13, isTab: 2, isCity: 8},
			{isName: "Cripple the Colosimo Clan's Assets (1.926)", isJobID: 14, isTab: 2, isCity: 8},
			{isName: "Ambush the Don's Limo (1.939)", isJobID: 15, isTab: 2, isCity: 8},
			{isName: "Get the Respect You Deserve (1.972)", isJobID: 16, isTab: 2, isCity: 8}
		],
		D3:[ 
			{isName: "Move Smuggled Liquor (1.889)", isJobID: 17, isTab: 3, isCity: 8},
			{isName: "Collect Income From Your Establishments (1.974)", isJobID: 18, isTab: 3, isCity: 8},
			{isName: "Stuff Local Cop's Pockets With Greens (1.905)", isJobID: 19, isTab: 3, isCity: 8},
			{isName: "Organize a Private Party (1.926)", isJobID: 20, isTab: 3, isCity: 8},
			{isName: "Evade an Ambush (1.852)", isJobID: 21, isTab: 3, isCity: 8},
			{isName: "Uncover a Plot Against You (1.868)", isJobID: 22, isTab: 3, isCity: 8},
			{isName: "Order a Hit on Disloyal Associates (1.938)", isJobID: 23, isTab: 3, isCity: 8},
			{isName: "Put Brother Franky in Concrete Shoes (1.882)", isJobID: 24, isTab: 3, isCity: 8}
		],
		D4:[
			{isName: "Set Up a Distillery in Cicero (1.662)", isJobID: 25, isTab: 4, isCity: 8},
			{isName: "Meet With a Mayoral Candidate (1.734)", isJobID: 26, isTab: 4, isCity: 8},
			{isName: "Threaten Voters at Polling Stations (1.696)", isJobID: 27, isTab: 4, isCity: 8},
			{isName: "Get Puppet Mayor Elected (1.722)", isJobID: 28, isTab: 4, isCity: 8},
			{isName: "Escape a Federal Agents Raid on Your Distillery (1.711)", isJobID: 29, isTab: 4, isCity: 8},
			{isName: "Find Out About Mayor's Dealings With the Bureau (1.667)", isJobID: 30, isTab: 4, isCity: 8},
			{isName: "Blackmail a Prohibition Bureau Top Agent (1.824)", isJobID: 31, isTab: 4, isCity: 8},
			{isName: "Frame Mayor in a Political Scandal (1.867)", isJobID: 32, isTab: 4, isCity: 8}
		],
		D5:[ 
			{isName: "Travel South to the Caribbean (1.965)", isJobID: 33, isTab: 5, isCity: 8},
			{isName: "Set Up a Rum Running Base of Operation (1.84)", isJobID: 34, isTab: 5, isCity: 8},
			{isName: "Monitor Coast Guard Patrols (1.957)", isJobID: 35, isTab: 5, isCity: 8},
			{isName: "Hijack a Rival Ship (1.743)", isJobID: 36, isTab: 5, isCity: 8},
			{isName: "Eliminate the Competition (1.867)", isJobID: 37, isTab: 5, isCity: 8},
			{isName: "Comb the Beach for Scraps (1.831)", isJobID: 38, isTab: 5, isCity: 8},
			{isName: "Ferry Customers Across the Rum Line (1.965)", isJobID: 39, isTab: 5, isCity: 8},
			{isName: "Host Happy Hours on Board (1.939)", isJobID: 40, isTab: 5, isCity: 8}
		],
		D6:[
			{isName: "Catch a Saboteur (1.974)", isJobID: 41, isTab: 6, isCity: 8},
			{isName: "Storm Into a North Side Gang Brewery (2.078)", isJobID: 42, isTab: 6, isCity: 8},
			{isName: "Dodge a Firebombing on Your Headquarters (1.982)", isJobID: 43, isTab: 6, isCity: 8},
			{isName: "Salvage Your Valuables From a Blazing Fire (1.948)", isJobID: 44, isTab: 6, isCity: 8},
			{isName: "Call for a Truce With the North Siders (1.988)", isJobID: 45, isTab: 6, isCity: 8},
			{isName: "Narrowly Survive an Assassination Attempt (1.957)", isJobID: 46, isTab: 6, isCity: 8},
			{isName: "Plan a Decisive Blow Against the North Siders (1.988)", isJobID: 47, isTab: 6, isCity: 8},
			{isName: "Flee the Scene Before the Police Arrive (1.963)", isJobID: 48, isTab: 6, isCity: 8}
		]
	};
	
	var LONJobMap = {
		D1:[
			{isName: "Claim Your Winnings After The Match (1.281)", isJobID: 1, isTab: 1, isCity: 9},
			{isName: "Fight Off The Thugs (1.496)", isJobID: 2, isTab: 1, isCity: 9},
			{isName: "Discuss Your Options With The Betting Mafia (1.496)", isJobID: 3, isTab: 1, isCity: 9},
			{isName: "Persuade \"The Kid\" To Throw The Championship Fight (1.281)", isJobID: 4, isTab: 1, isCity: 9},
			{isName: "Spike \"The Kid's\" Energy Drink With A Neurotoxin (1.602)", isJobID: 5, isTab: 1, isCity: 9},
			{isName: "Bet On \"The Kid\" Losing The Championship Fight (1.423)", isJobID: 6, isTab: 1, isCity: 9},
			{isName: "Watch The Fight (1.373)", isJobID: 7, isTab: 1, isCity: 9},
			{isName: "Collect Your Take (1.707)", isJobID: 8, isTab: 1, isCity: 9}
		],
		D2:[
			{isName: "Force An Immigrant Family From Their Home (1.373)", isJobID: 9, isTab: 2, isCity: 9},
			{isName: "Meet The Land Mafia To Collect Your Take (1.707)", isJobID: 10, isTab: 2, isCity: 9},
			{isName: "Intimidate The New Celebrity Residents (1.602)", isJobID: 11, isTab: 2, isCity: 9},
			{isName: "Case The Nouvelle Vague Art Gallery (1.868)", isJobID: 12, isTab: 2, isCity: 9},
			{isName: "Destroy The Rare East End Works Painting (1.778)", isJobID: 13, isTab: 2, isCity: 9},
			{isName: "Burn Down A Brand New Condo (1.815)", isJobID: 14, isTab: 2, isCity: 9},
			{isName: "Collect Your Take From The Construction Firms (2.134)", isJobID: 15, isTab: 2, isCity: 9},
			{isName: "Leave The East End (1.957)", isJobID: 16, isTab: 2, isCity: 9}
		],
		D3:[ 
			{isName: "Write About The Mysterious Shooting (1.887)", isJobID: 17, isTab: 3, isCity: 9},
			{isName: "Work With The PI At The Crime Scene (1.829)", isJobID: 18, isTab: 3, isCity: 9},
			{isName: "Approach The Police With Leads (2.051)", isJobID: 19, isTab: 3, isCity: 9},
			{isName: "Search For A Trail (1.921)", isJobID: 20, isTab: 3, isCity: 9},
			{isName: "Threaten To Expose The Royal (1.849)", isJobID: 21, isTab: 3, isCity: 9},
			{isName: "Lay A Trap For The Royal (1.867)", isJobID: 22, isTab: 3, isCity: 9},
			{isName: "Tell The Editor The Truth (1.82)", isJobID: 23, isTab: 3, isCity: 9},
			{isName: "Publish False Story Under Threat (1.867)", isJobID: 24, isTab: 3, isCity: 9}
		],
		D4:[
			{isName: "Accept The Offer Made By The Russians (1.778)", isJobID: 25, isTab: 4, isCity: 9},
			{isName: "Provide Insider Information On Your Gang (2.074)", isJobID: 26, isTab: 4, isCity: 9},
			{isName: "Escape The Hitmen After Being Discovered (1.92)", isJobID: 27, isTab: 4, isCity: 9},
			{isName: "Take Shelter In A Warehouse (2.021)", isJobID: 28, isTab: 4, isCity: 9},
			{isName: "Fake Your Own Death (1.88)", isJobID: 29, isTab: 4, isCity: 9},
			{isName: "Create A Russian Identity (2.081)", isJobID: 30, isTab: 4, isCity: 9},
			{isName: "Eliminate Your Gang With The Russians (1.93)", isJobID: 31, isTab: 4, isCity: 9},
			{isName: "Run The Racket (1.981)", isJobID: 32, isTab: 4, isCity: 9}
		],
		D5:[ 
			{isName: "Sneak Into The Gambling Den (1.92)", isJobID: 33, isTab: 5, isCity: 9},
			{isName: "Gamble Away All Your Savings (1.93)", isJobID: 34, isTab: 5, isCity: 9},
			{isName: "Bargain To Push 'Power Ups' To Pay Off Your Debts (1.891)", isJobID: 35, isTab: 5, isCity: 9},
			{isName: "Sell 'Power Ups' At School (2.087)", isJobID: 36, isTab: 5, isCity: 9},
			{isName: "Start An Operation (1.981)", isJobID: 37, isTab: 5, isCity: 9},
			{isName: "Pay Off Your Debts (1.988)", isJobID: 38, isTab: 5, isCity: 9},
			{isName: "Run Your Empire (2.241)", isJobID: 39, isTab: 5, isCity: 9},
			{isName: "Join The Inner Circle (2.087)", isJobID: 40, isTab: 5, isCity: 9}
		],
		D6:[
			{isName: "Analyze Your Agent's Data (1.93)", isJobID: 41, isTab: 6, isCity: 9},
			{isName: "Organize A Raid On The Gang Hideout (1.891)", isJobID: 42, isTab: 6, isCity: 9},
			{isName: "Ambush The Convoy Transporting The Gang Boss (2.087)", isJobID: 43, isTab: 6, isCity: 9},
			{isName: "Drive The Gang Boss To A Safehouse (2.045)", isJobID: 44, isTab: 6, isCity: 9},
			{isName: "Forge The Reports (2.176)", isJobID: 45, isTab: 6, isCity: 9},
			{isName: "Observe Your Agent Snooping Around (2.083)", isJobID: 46, isTab: 6, isCity: 9},
			{isName: "Snipe Your Agent Before He Goes Public (1.929)", isJobID: 47, isTab: 6, isCity: 9},
			{isName: "Close The Investigation (2.048)", isJobID: 48, isTab: 6, isCity: 9}
		],
		D7:[
			{isName: "Track Down Your Target (2.134)", isJobID: 49, isTab: 7, isCity: 9},
			{isName: "Assassinate Your Target (2.027)", isJobID: 50, isTab: 7, isCity: 9},
			{isName: "Declare Your Retirement To The Boss (2)", isJobID: 51, isTab: 7, isCity: 9},
			{isName: "Chase Down Your Son's Kidnappers (2.231)", isJobID: 52, isTab: 7, isCity: 9},
			{isName: "Sneak Into The Manor (2.19)", isJobID: 53, isTab: 7, isCity: 9},
			{isName: "Rescue Your Son (1.92)", isJobID: 54, isTab: 7, isCity: 9},
			{isName: "Take Out The Boss And His Guards (2.037)", isJobID: 55, isTab: 7, isCity: 9},
			{isName: "Retire To The Isle Of Wight (2.226)", isJobID: 56, isTab: 7, isCity: 9}
		],
		D8:[
			{isName: "Meet Your Source (2.021)", isJobID: 57, isTab: 8, isCity: 9},
			{isName: "Investigate The Trail Of The Puzzle Box (2.252)", isJobID: 58, isTab: 8, isCity: 9},
			{isName: "Audition Your Potential Partners (2.045)", isJobID: 59, isTab: 8, isCity: 9},
			{isName: "Storm The Tower Of London (2.037)", isJobID: 60, isTab: 8, isCity: 9},
			{isName: "Steal The Puzzle Box (2.134)", isJobID: 61, isTab: 8, isCity: 9},
			{isName: "Fight Off The Police (2.279)", isJobID: 62, isTab: 8, isCity: 9},
			{isName: "Escape Into The Back Alleys (2.133)", isJobID: 63, isTab: 8, isCity: 9},
			{isName: "Open The Puzzle Box (1.969)", isJobID: 64, isTab: 8, isCity: 9}
		],
		D9:[
			{isName: "Set Up A Drug Racket From Your Kebab Shop (2.193)", isJobID: 65, isTab: 9, isCity: 9},
			{isName: "Expand The Business With Turkish Smugglers' Help (2.19)", isJobID: 66, isTab: 9, isCity: 9},
			{isName: "Reap The Benefits (2.226)", isJobID: 67, isTab: 9, isCity: 9},
			{isName: "Suspect Foul Play (2.187)", isJobID: 68, isTab: 9, isCity: 9},
			{isName: "Silence Your Disloyal Associates (2.134)", isJobID: 69, isTab: 9, isCity: 9},
			{isName: "Pretend To Be A Survivor (2.134)", isJobID: 70, isTab: 9, isCity: 9},
			{isName: "Get Compensation From Insurance Company (2.048)", isJobID: 71, isTab: 9, isCity: 9},
			{isName: "Open Various Branches Across London But Beware (2.051)", isJobID: 72, isTab: 9, isCity: 9}
		],
		D10:[
			{isName: "Queue Up At The Grande Stadium For The Game (2.134)", isJobID: 73, isTab: 10, isCity: 9},
			{isName: "Enjoy The Game At Rival Team's Cost (2.252)", isJobID: 74, isTab: 10, isCity: 9},
			{isName: "Go To A Pub To Celebrate Your Team's Win (2.231)", isJobID: 75, isTab: 10, isCity: 9},
			{isName: "Poke Your Team's Victory In Rival Fans' Faces (2.226)", isJobID: 76, isTab: 10, isCity: 9},
			{isName: "Defend Yourself From The Rival's Fans (2.231)", isJobID: 77, isTab: 10, isCity: 9},
			{isName: "Make A Run For It And Hide (2.187)", isJobID: 78, isTab: 10, isCity: 9},
			{isName: "Speak To Your Uncle With Connections (2.222)", isJobID: 79, isTab: 10, isCity: 9},
			{isName: "Make The Club Pay For Their Disrespect (2.226)", isJobID: 80, isTab: 10, isCity: 9}
		]
	};
/*
	var SAJobMap = {
		D1:[
			{isName: "Help Out At The Shipwreck (1.754)", isJobID: 1, isTab: 1, isCity: 10},
			{isName: "Steal The Cargo Of Diamonds (1.945)", isJobID: 2, isTab: 1, isCity: 10},
			{isName: "Hunt For The Highest Bidder (1.98)", isJobID: 3, isTab: 1, isCity: 10},
			{isName: "Rally The Union To Join Your Operation (1.994)", isJobID: 4, isTab: 1, isCity: 10},
			{isName: "Hide Your Shipment (2.024)", isJobID: 5, isTab: 1, isCity: 10},
			{isName: "Discover A Rat In Your Operation (2.024)", isJobID: 6, isTab: 1, isCity: 10},
			{isName: "Hire The Mafia As Muscle (2.047)", isJobID: 7, isTab: 1, isCity: 10},
			{isName: "Protect Your Shipment Into International Waters (2.126)", isJobID: 8, isTab: 1, isCity: 10},
			{isName: "Join Forces With The Mafia (2.126)", isJobID: 9, isTab: 1, isCity: 10},
			{isName: "Set Up A Diamond Smuggling Racket (2.237)", isJobID: 10, isTab: 1, isCity: 10}
		],
		D2:[
			{isName: "Steal A Diamond At Work (1.822)", isJobID: 11, isTab: 2, isCity: 10},
			{isName: "Defend Yourself Against The Supervisors (1.949)", isJobID: 12, isTab: 2, isCity: 10},
			{isName: "Distract The Guards (2.024)", isJobID: 13, isTab: 2, isCity: 10},
			{isName: "Loot The Safe Of Diamonds (1.889)", isJobID: 14, isTab: 2, isCity: 10},
			{isName: "Locate The Militia By The River (1.889)", isJobID: 15, isTab: 2, isCity: 10},
			{isName: "Trade Diamonds For High-Grade Weapons (2.105)", isJobID: 16, isTab: 2, isCity: 10},
			{isName: "Incite The Miners to Riot (2.126)", isJobID: 17, isTab: 2, isCity: 10},
			{isName: "Wage War Against The Mining Corporation (2.086)", isJobID: 18, isTab: 2, isCity: 10},
			{isName: "Establish Yourself As A Rebel Leader (2.19)", isJobID: 19, isTab: 2, isCity: 10},
			{isName: "Distribute The Spoils Of War (2.267)", isJobID: 20, isTab: 2, isCity: 10}
		],
		D3:[ 
			{isName: "Accept The Job For A Top-Secret Mission (1.889)", isJobID: 21, isTab: 3, isCity: 10},
			{isName: "Reach The Medical Facility Without Being Noticed (2.126)", isJobID: 22, isTab: 3, isCity: 10},
			{isName: "Dodge All High Security Elements (2.024)", isJobID: 23, isTab: 3, isCity: 10},
			{isName: "Gain Access To The Disease Containment Chamber (2.126)", isJobID: 24, isTab: 3, isCity: 10},
			{isName: "Eliminate An Unexpected Roadblock (2.024)", isJobID: 25, isTab: 3, isCity: 10},
			{isName: "Open The Virus Vault With Protective Gear (2.227)", isJobID: 26, isTab: 3, isCity: 10},
			{isName: "Take What You Came For (2.126)", isJobID: 27, isTab: 3, isCity: 10},
			{isName: "Flee The Scene Without Leaving A Trail (2.204)", isJobID: 28, isTab: 3, isCity: 10},
			{isName: "Be At The Right Place At The Right Time (2.18)", isJobID: 29, isTab: 3, isCity: 10},
			{isName: "Sell The Virus To The Highest Bidder (2.289)", isJobID: 30, isTab: 3, isCity: 10}
		],
		D4:[
			{isName: "Spy On The Witch Doctor (1.786)", isJobID: 31, isTab: 4, isCity: 10},
			{isName: "Discover The Secret Location Of The Herbs (1.877)", isJobID: 32, isTab: 4, isCity: 10},
			{isName: "Fake An Injury And Seek Doctor's Aid (1.913)", isJobID: 33, isTab: 4, isCity: 10},
			{isName: "Offer A Contract To The Witch Doctor (1.9)", isJobID: 34, isTab: 4, isCity: 10},
			{isName: "Threaten The Doctor To Part With His \"Herbal Meds\" (2.127)", isJobID: 35, isTab: 4, isCity: 10},
			{isName: "Gather A Mob To Force Doctor To Agree (1.99)", isJobID: 36, isTab: 4, isCity: 10},
			{isName: "Set Doctor's House On Fire As A Warning (2.225)", isJobID: 37, isTab: 4, isCity: 10},
			{isName: "Discover That The Doctor Has Escaped (2.162)", isJobID: 38, isTab: 4, isCity: 10},
			{isName: "Launch A Manhunt For Doctor (2.254)", isJobID: 39, isTab: 4, isCity: 10},
			{isName: "Ensure That The Doctor Is In The Boss' Clutches (2.294)", isJobID: 40, isTab: 4, isCity: 10}
		],
		D5:[ 
			{isName: "Acquire Car Parts From Local Hoodlums (1.798)", isJobID: 41, isTab: 5, isCity: 10},
			{isName: "Offer Your Expertise For Their Business (1.875)", isJobID: 42, isTab: 5, isCity: 10},
			{isName: "Go Through A Series Of Tests To Prove Yourself (1.913)", isJobID: 43, isTab: 5, isCity: 10},
			{isName: "Get Recruited For A Lucrative Project (2.139)", isJobID: 44, isTab: 5, isCity: 10},
			{isName: "Proceed To Dealer's Warehouse (1.965)", isJobID: 45, isTab: 5, isCity: 10},
			{isName: "Discover A Special Package In The Car (2.211)", isJobID: 46, isTab: 5, isCity: 10},
			{isName: "Notice That You Are Being Followed (2.246)", isJobID: 47, isTab: 5, isCity: 10},
			{isName: "Lose Them On The Highway (2.238)", isJobID: 48, isTab: 5, isCity: 10},
			{isName: "Bury Your Treasure In A Nearby Field (2.258)", isJobID: 49, isTab: 5, isCity: 10},
			{isName: "Finish Your Car-Jacking Job As Planned (2.302)", isJobID: 50, isTab: 5, isCity: 10}
		],
		D6:[
			{isName: "Assign Your Protege To An Undercover Operation (1.849)", isJobID: 51, isTab: 6, isCity: 10},
			{isName: "Crack Down On Narcotics Rings In The Slums (1.887)", isJobID: 52, isTab: 6, isCity: 10},
			{isName: "Bring Your Protege In On Your Operation (2.154)", isJobID: 53, isTab: 6, isCity: 10},
			{isName: "Stage A Break In Into The Evidence Room (1.951)", isJobID: 54, isTab: 6, isCity: 10},
			{isName: "Find Prospective Buyers In The Mafia (2.196)", isJobID: 55, isTab: 6, isCity: 10},
			{isName: "Resell Snow Candy To The Mafia (2.225)", isJobID: 56, isTab: 6, isCity: 10},
			{isName: "Run A Substance Raid In The Slums (2.24)", isJobID: 57, isTab: 6, isCity: 10},
			{isName: "Fake The Arrest Of Your Protege (2.239)", isJobID: 58, isTab: 6, isCity: 10},
			{isName: "Shift To Another Precinct In The City (2.267)", isJobID: 59, isTab: 6, isCity: 10},
			{isName: "Get Cure For Disease With Your Profits (2.306)", isJobID: 60, isTab: 6, isCity: 10}
		],
		D7:[
			{isName: "Refuse To Poach For Rhino Horns And Ivory (1.874)", isJobID: 61, isTab: 7, isCity: 10},
			{isName: "Give In To Militant Pressure To Poach (1.913)", isJobID: 62, isTab: 7, isCity: 10},
			{isName: "Track Down And Hunt Rhinos (2.154)", isJobID: 63, isTab: 7, isCity: 10},
			{isName: "Make A Futile Attempt To Escape Rangers (2.184)", isJobID: 64, isTab: 7, isCity: 10},
			{isName: "Endure Torture During Interrogation (2.211)", isJobID: 65, isTab: 7, isCity: 10},
			{isName: "Cut A Deal With Rangers (2.224)", isJobID: 66, isTab: 7, isCity: 10},
			{isName: "Lead Rangers To Closest Militant Hideout (2.232)", isJobID: 67, isTab: 7, isCity: 10},
			{isName: "Take Cover From Gunfire (2.246)", isJobID: 68, isTab: 7, isCity: 10},
			{isName: "Expose Other Militant Pockets (2.296)", isJobID: 69, isTab: 7, isCity: 10},
			{isName: "Become An Informer For The Rangers (2.313)", isJobID: 70, isTab: 7, isCity: 10}
		],
		D8:[
			{isName: "Launch An Assault On The Football Stadium (2.09)", isJobID: 71, isTab: 8, isCity: 10},
			{isName: "Demand That The President Be Surrendered To You (1.926)", isJobID: 72, isTab: 8, isCity: 10},
			{isName: "Give The President Time To Escape (2.267)", isJobID: 73, isTab: 8, isCity: 10},
			{isName: "Launch Deadly Virus Grenades Into The Crowd (2.196)", isJobID: 74, isTab: 8, isCity: 10},
			{isName: "Abduct The Nation's Most Influential Media Mogul (2.296)", isJobID: 75, isTab: 8, isCity: 10},
			{isName: "Blow Up The Grounded Blimp To Cover Your Escape (2.241)", isJobID: 76, isTab: 8, isCity: 10},
			{isName: "Secure The Hideout While You Wait For The Boss (2.311)", isJobID: 77, isTab: 8, isCity: 10},
			{isName: "Persuade The Mogul To Join Your Cause (2.282)", isJobID: 78, isTab: 8, isCity: 10},
			{isName: "Release Footage Of The President Abandoning The Stadium Victims (2.366)", isJobID: 79, isTab: 8, isCity: 10},
			{isName: "Influence Public Opinion Through The Mogul's News Networks (2.395)", isJobID: 80, isTab: 8, isCity: 10}
		],
		D9:[
			{isName: "Alert President Of Public Frenzy (1.964)", isJobID: 81, isTab: 9, isCity: 10},
			{isName: "Call For A Meeting In A Secluded Location (2.224)", isJobID: 82, isTab: 9, isCity: 10},
			{isName: "Join President's Entourage At Springbok (2.296)", isJobID: 83, isTab: 9, isCity: 10},
			{isName: "Protect President From Public Humiliation (2.239)", isJobID: 84, isTab: 9, isCity: 10},
			{isName: "Transport President To Safe House (2.254)", isJobID: 85, isTab: 9, isCity: 10},
			{isName: "Double-Cross the President (2.324)", isJobID: 86, isTab: 9, isCity: 10},
			{isName: "Force President To Confront His Past (2.26)", isJobID: 87, isTab: 9, isCity: 10},
			{isName: "Record President's Confession To Crimes Of Genocide (2.285)", isJobID: 88, isTab: 9, isCity: 10},
			{isName: "Tip-Off President's Whereabouts To Police (2.387)", isJobID: 89, isTab: 9, isCity: 10},
			{isName: "Escape Safe House Unnoticed (2.401)", isJobID: 90, isTab: 9, isCity: 10}
		],
		D10:[
			{isName: "Gain The Cooperation Of Key Members Of Parliament (2.163)", isJobID: 91, isTab: 10, isCity: 10},
			{isName: "Take Control Of The Leading Political Party (2.225)", isJobID: 92, isTab: 10, isCity: 10},
			{isName: "Organize Terror Attacks By Your Militants (2.296)", isJobID: 93, isTab: 10, isCity: 10},
			{isName: "Double Cross And Have Them Eliminated (2.222)", isJobID: 94, isTab: 10, isCity: 10},
			{isName: "Declare A State Of Emergency In The Country (2.253)", isJobID: 95, isTab: 10, isCity: 10},
			{isName: "Establish Martial Law (2.282)", isJobID: 96, isTab: 10, isCity: 10},
			{isName: "Offer Restitution To Terror Attack Victims (2.270)", isJobID: 97, isTab: 10, isCity: 10},
			{isName: "Publicize Your Philanthropy To Win Public Approval (2.290)", isJobID: 98, isTab: 10, isCity: 10},
			{isName: "Get Sworn In As President (2.416)", isJobID: 99, isTab: 10, isCity: 10},
			{isName: "Offer Your Associates Key Roles In The Cabinet (2.423)", isJobID: 120, isTab: 10, isCity: 10}
		]
	};	
	*/
	var MEXJobMap = {
		D1:[
			{isName: "Rob Rival Cartel's Latest Shipment (1.851)", isJobID: 1, isTab: 1, isCity: 11},
			{isName: "Escape Cartel's Retaliation (1.859)", isJobID: 2, isTab: 1, isCity: 11},
			{isName: "Visit Your Go-Down To Check On The Goods (2.039)", isJobID: 3, isTab: 1, isCity: 11},
			{isName: "Receive A Threat That Is Loud But Not So Clear (1.884)", isJobID: 4, isTab: 1, isCity: 11},
			{isName: "Extort Vital Information From Local Peddlers (1.942)", isJobID: 5, isTab: 1, isCity: 11},
			{isName: "Dispose Of Them Once You've Heard Enough (2.013)", isJobID: 6, isTab: 1, isCity: 11},
			{isName: "Declare War On Rival's Hacienda (1.993)", isJobID: 7, isTab: 1, isCity: 11},
			{isName: "Put An End To This Rivalry Once And For All (2.075)", isJobID: 8, isTab: 1, isCity: 11},
			{isName: "Retrieve All That Was Yours And More (2.076)", isJobID: 9, isTab: 1, isCity: 11},
			{isName: "Offer Cops Plata O Plomo To Run A Smooth Operation (2.124)", isJobID: 10, isTab: 1, isCity: 11}
		],
		D2:[
			{isName: "Reward Your Cartel Moles For Inside Information (2.089)", isJobID: 11, isTab: 2, isCity: 11},
			{isName: "Recruit Ex-Elite Commandos To Strengthen Your Mafia (2.105)", isJobID: 12, isTab: 2, isCity: 11},
			{isName: "Use Your Crew To Intimidate The Cartel's Thugs (2.236)", isJobID: 13, isTab: 2, isCity: 11},
			{isName: "Take Control Of Product Distribution On The Streets (2.144)", isJobID: 14, isTab: 2, isCity: 11},
			{isName: "Orchestrate A Jail Break To Keep The Federales Busy (2.080)", isJobID: 15, isTab: 2, isCity: 11},
			{isName: "Recruit The Convicts With The Most Useful Skills (2.080)", isJobID: 16, isTab: 2, isCity: 11},
			{isName: "Steal Military Surplus To Get Equipped For The Showdown (2.233)", isJobID: 17, isTab: 2, isCity: 11},
			{isName: "Use Superior Military Tactics To Take Down The Cartel (2.159)", isJobID: 18, isTab: 2, isCity: 11},
			{isName: "Establish Smooth Supply Through Monopolized Routes (2.232)", isJobID: 19, isTab: 2, isCity: 11},
			{isName: "Grow The Operation To Facilitate Trans-Atlantic Trafficking (2.255)", isJobID: 20, isTab: 2, isCity: 11}
		],
		D3:[ 
			{isName: "Escape Through The Desert With Fellow Immigrants (2.095)", isJobID: 21, isTab: 3, isCity: 11},
			{isName: "Fight Back When Coyotes Turn On You (2.119)", isJobID: 22, isTab: 3, isCity: 11},
			{isName: "Make Your Way Through The Desert To Safety (2.080)", isJobID: 23, isTab: 3, isCity: 11},
			{isName: "Stumble Upon A Cartel's Secret Goods Drop (2.208)", isJobID: 24, isTab: 3, isCity: 11},
			{isName: "Wait For Nightfall To Steal The Cartel's Money (2.101)", isJobID: 25, isTab: 3, isCity: 11},
			{isName: "Set Goods On Fire To Distract The Guards (2.233)", isJobID: 26, isTab: 3, isCity: 11},
			{isName: "Retrieve The Child From His Hiding Place (2.136)", isJobID: 27, isTab: 3, isCity: 11},
			{isName: "Kill To Protect The Only Family You Have Left (2.136)", isJobID: 28, isTab: 3, isCity: 11},
			{isName: "Stow Away On Goods Delivery Plane (2.280)", isJobID: 29, isTab: 3, isCity: 11},
			{isName: "Bribe The Pilot When You're Discovered (2.323)", isJobID: 30, isTab: 3, isCity: 11}
		],
		D4:[
			{isName: "Arrange The Sale Of Your New Weapons Shipment (2.069)", isJobID: 31, isTab: 4, isCity: 11},
			{isName: "Refuse To Deliver Until The Cobrizo Cartel Pays In Full (2.098)", isJobID: 32, isTab: 4, isCity: 11},
			{isName: "Accept Your Brother's Help To Transport The Shipment (2.118)", isJobID: 33, isTab: 4, isCity: 11},
			{isName: "Fend Off An Attack On The Way To The Weapons Cache (2.213)", isJobID: 34, isTab: 4, isCity: 11},
			{isName: "Give Up Your Hideout In Exchange For Your Life (2.163)", isJobID: 35, isTab: 4, isCity: 11},
			{isName: "Transport The Shipment To The Cobrizo Warehouse (2.232)", isJobID: 36, isTab: 4, isCity: 11},
			{isName: "Invite The Cobrizo Cartel To Inspect New Merchandise (2.111)", isJobID: 37, isTab: 4, isCity: 11},
			{isName: "Avoid The Cross-Fire As Interpol Makes Arrests (2.268)", isJobID: 38, isTab: 4, isCity: 11},
			{isName: "Track Down Your Brother At The Cobrizo Safe House (2.204)", isJobID: 39, isTab: 4, isCity: 11},
			{isName: "Make Peace With Your Decision To Get Revenge (2.301)", isJobID: 40, isTab: 4, isCity: 11}
		],
		D5:[ 
			{isName: "Abduct Passed Out Party Goers (2.097)", isJobID: 41, isTab: 5, isCity: 11},
			{isName: "Harvest Organs For Smuggling (2.126)", isJobID: 42, isTab: 5, isCity: 11},
			{isName: "Accompany Team On Lucrative Operation (2.217)", isJobID: 43, isTab: 5, isCity: 11},
			{isName: "Be Rescued By A Group Of Autodefensas (2.101)", isJobID: 44, isTab: 5, isCity: 11},
			{isName: "Refuse Doctor's Diagnosis Of Amnesia (2.059)", isJobID: 45, isTab: 5, isCity: 11},
			{isName: "Attempt To Unravel Your Identity (2.235)", isJobID: 46, isTab: 5, isCity: 11},
			{isName: "Reject Your Mafia's Proposal To Rejoin Family (2.114)", isJobID: 47, isTab: 5, isCity: 11},
			{isName: "Cut Off All Ties With Your Mafia (2.271)", isJobID: 48, isTab: 5, isCity: 11},
			{isName: "Embrace Autodefensas' Ideology As Your Own (2.173)", isJobID: 49, isTab: 5, isCity: 11},
			{isName: "Put An End To Your Ex-Mafia\'s Operations (2.317)", isJobID: 50, isTab: 5, isCity: 11}
		],
		D6:[ 
			{isName: "Lure The Casino Owner's Wife Away From The Party (2.113)", isJobID: 51, isTab: 6, isCity: 11},
			{isName: "Demand A Ransom From The Casino Owner (2.195)", isJobID: 52, isTab: 6, isCity: 11},
			{isName: "Hold Up Under Intense Interrogation (2.164)", isJobID: 53, isTab: 6, isCity: 11},
			{isName: "Have Your 'Lawyer' Plant The Call Jammer (2.245)", isJobID: 54, isTab: 6, isCity: 11},
			{isName: "Evade The Police At The Ransom Drop Site (2.195)", isJobID: 55, isTab: 6, isCity: 11},
			{isName: "Snatch The Casino Owner In The Confusion (2.249)", isJobID: 56, isTab: 6, isCity: 11},
			{isName: "Use The Owner To Get Past Casino Security (2.245)", isJobID: 57, isTab: 6, isCity: 11},
			{isName: "Empty The Vault Before The Guards Wise Up (2.258)", isJobID: 58, isTab: 6, isCity: 11},
			{isName: "Get Rid Of Excess Baggage (2.290)", isJobID: 59, isTab: 6, isCity: 11},
			{isName: "Lie Low Until The Excitement Dies Down (2.319)", isJobID: 60, isTab: 6, isCity: 11}
		],
		D7:[ 
			{isName: "Meet With A Don To Accept A Contract (2.204)", isJobID: 61, isCity: 11, isTab: 7},
			{isName: "Escape When You're Set Up For His Murder (2.257)", isJobID: 62, isCity: 11, isTab: 7},
			{isName: "Force Police Involvement By Faking a Tip (2.184)", isJobID: 63, isCity: 11, isTab: 7},
			{isName: "Equip Yourself At The Station's Armory (2.281)", isJobID: 64, isCity: 11, isTab: 7},
			{isName: "Storm The Warehouse To Rescue Your Comrades (2.225)", isJobID: 65, isCity: 11, isTab: 7},
			{isName: "Hide Evidence Of Their Criminal Double Life (2.282)", isJobID: 66, isCity: 11, isTab: 7},
			{isName: "Chase Down The Old Don's Lieutenant (2.230)", isJobID: 67, isCity: 11, isTab: 7},
			{isName: "Record His Confession To Killing The Don (2.294)", isJobID: 68, isCity: 11, isTab: 7},
			{isName: "Deliver The Lieutenant To The Don's Family (2.267)", isJobID: 69, isCity: 11, isTab: 7},
			{isName: "Split The Reward Between Your Comrades' Families (2.334)", isJobID: 70, isCity: 11, isTab: 7}
		],
		D8:[ 
			{isName: "Practice Free Climbing At An Old Temple (2.211)", isJobID: 71, isCity: 11, isTab: 8},
			{isName: "Stumble On Ancient Mayan Treasures (2.246)", isJobID: 72, isCity: 11, isTab: 8},
			{isName: "Have Your Applications For The Contest Rejected (2.235)", isJobID: 73, isCity: 11, isTab: 8},
			{isName: "Bribe An Organizer To Squeeze You Into The Contest (2.287)", isJobID: 74, isCity: 11, isTab: 8},
			{isName: "Give Into The Greedy Organizer's Demands For More (2.293)", isJobID: 75, isCity: 11, isTab: 8},
			{isName: "Hand Over The Treasure In Exchange For Your Lives (2.210)", isJobID: 76, isCity: 11, isTab: 8},
			{isName: "Escape While The Organizer Deals With Your Friends (2.267)", isJobID: 77, isCity: 11, isTab: 8},
			{isName: "Follow Your Treasure (2.253)", isJobID: 78, isCity: 11, isTab: 8},
			{isName: "Deduce The Organizer's New Hiding Place (2.303)", isJobID: 79, isCity: 11, isTab: 8},
			{isName: "Bide your Time Until You Can Exact Revenge (2.348)", isJobID: 80, isCity: 11, isTab: 8}
		],
		D9:[ 
			{isName: "Meet A Rich Mining Boss Regarding A Secret Op (2.246)", isJobID: 81, isCity: 11, isTab: 9},
			{isName: "Accept Job And Ask To Use His Boats As Payment (2.299)", isJobID: 82, isCity: 11, isTab: 9},
			{isName: "Cause 'Accidents' On The Rival's Mine (2.333)", isJobID: 83, isCity: 11, isTab: 9},
			{isName: "Discover That The Boss Has Gone Back On His Word (2.259)", isJobID: 84, isCity: 11, isTab: 9},
			{isName: "Seek Fair Share Of Profits Among Other Demands (2.342)", isJobID: 85, isCity: 11, isTab: 9},
			{isName: "Use Force To Take Over Both Mines (2.311)", isJobID: 86, isCity: 11, isTab: 9},
			{isName: "Conduct A Dry Run On Your Smuggling Operations (2.347)", isJobID: 87, isCity: 11, isTab: 9},
			{isName: "Move Out Your Large Shipment Secretly (2.271)", isJobID: 88, isCity: 11, isTab: 9},
			{isName: "Discover You've Become The Target Of The Mining Lords (2.355)", isJobID: 89, isCity: 11, isTab: 9},
			{isName: "Escape An Attempt On Your Life (2.376)", isJobID: 90, isCity: 11, isTab: 9}
		],		
		D10:[ 
			{isName: "Escape The Raid On Your Packaging Unit (2.320)", isJobID: 91, isCity: 11, isTab: 10},
			{isName: "Track Your Seized Goods To The Comisaria (2.346)", isJobID: 92, isCity: 11, isTab: 10},
			{isName: "Send Your Partner To Make A Deal With The Police (2.168)", isJobID: 93, isCity: 11, isTab: 10},
			{isName: "Hear Of His Incarceration When He Refuses To Betray You (2.362)", isJobID: 94, isCity: 11, isTab: 10},
			{isName: "Sabotage The Bull Pens To Create A Diversion (2.232)", isJobID: 95, isCity: 11, isTab: 10},
			{isName: "Separate The Attorney General From His Security Detail (2.323)", isJobID: 96, isCity: 11, isTab: 10},
			{isName: "Get Your Revenge On The Attorney General (2.394)", isJobID: 97, isCity: 11, isTab: 10},
			{isName: "Use His Death To Instigate Riots Across The city (2.277)", isJobID: 98, isCity: 11, isTab: 10},
			{isName: "Attack The Comisaria To Free Your Partner (2.324)", isJobID: 99, isCity: 11, isTab: 10},
			{isName: "Steal Back All Your Confiscated Goods (2.445)", isJobID: 100, isCity: 11, isTab: 10}
		],
		D11:[ 
			{isName: "Crash The Meeting Between Your Rival And His Customer (1.888)", isJobID: 101, isCity: 11, isTab: 11},
			{isName: "Steal The Data That Was Being Sold (2.045)", isJobID: 102, isCity: 11, isTab: 11},
			{isName: "Draw Your Rival Away So Your Team Can Escape (2.098)", isJobID: 103, isCity: 11, isTab: 11},
			{isName: "Destroy Your Truck When He Loses Your Trail (2.01)", isJobID: 104, isCity: 11, isTab: 11},
			{isName: "Survive The Perils Of The Desert At Night (2.103)", isJobID: 105, isCity: 11, isTab: 11},
			{isName: "Rendezvous With Your Team At A Secure Location (2.069)", isJobID: 106, isCity: 11, isTab: 11},
			{isName: "Hide In Plain Sight To Enter The Locked-Down Town (2.032)", isJobID: 107, isCity: 11, isTab: 11},
			{isName: "Send Out Feelers To Potential Buyers (2.045)", isJobID: 108, isCity: 11, isTab: 11},
			{isName: "Go On The Offensive And Track Down Your Rival (2.112)", isJobID: 109, isCity: 11, isTab: 11},
			{isName: "Eliminate The Threat Of His Retribution (2.16)", isJobID: 110, isCity: 11, isTab: 11}
		]
	};	
	
	var LAJobMap = {
		D1:[
			{isName: "Hear Of Your Ailing Boss' Brutal Murder (1.929)", isJobID: 1, isCity: 12, isTab: 1},
			{isName: "Secure The Bel Air Mansion (1.965)", isJobID: 2, isCity: 12, isTab: 1},
			{isName: "Call For An Urgent Meeting As The New Leader (2.077)", isJobID: 3, isCity: 12, isTab: 1},
			{isName: "Escape A Massacre At Your Home (1.984)", isJobID: 4, isCity: 12, isTab: 1},
			{isName: "Raise An Alarm To Call For Backup (2.050)", isJobID: 5, isCity: 12, isTab: 1},
			{isName: "Question And Eliminate One Of The Intruders (2.149)", isJobID: 6, isCity: 12, isTab: 1},
			{isName: "Stop The Fleeing Intruders (2.126)", isJobID: 7, isCity: 12, isTab: 1},
			{isName: "Freeze Offshore Bank Accounts (2.177)", isJobID: 8, isCity: 12, isTab: 1},
			{isName: "Head To Santa Monica To Find Some Answers (2.204)", isJobID: 9, isCity: 12, isTab: 1}
		],
		D2:[
			{isName: "Have Your Liutenants Join You On The Manhunt (2.069)", isJobID: 10, isCity: 12, isTab: 2},
			{isName: "Confirm That The Indruder's Leads Were Precise (2.099)", isJobID: 11, isCity: 12, isTab: 2},
			{isName: "Discover Steele's Identity From Trusted Bartender (2.063)", isJobID: 12, isCity: 12, isTab: 2},
			{isName: "Keep an Eye On John Steele (2.237)", isJobID: 13, isCity: 12, isTab: 2},
			{isName: "Get John Steele's Men Out Of The Way (2.145)", isJobID: 14, isCity: 12, isTab: 2},
			{isName: "Capture Steele And Head To His Chop Shop (2.126)", isJobID: 15, isCity: 12, isTab: 2},
			{isName: "Rough Up John Steele For Information (2.154)", isJobID: 16, isCity: 12, isTab: 2},
			{isName: "Eliminate Steele When He Finally Talks (2.088)", isJobID: 17, isCity: 12, isTab: 2},
			{isName: "Make Arrangements For An Offician Visit To Prison (2.227)", isJobID: 18, isCity: 12, isTab: 2}		
		],
		D3:[
			{isName: "Discover That In Flow Of Cash Has Dwindled Down (2.086)", isJobID: 19, isCity: 12, isTab: 3},
			{isName: "Hear Of Woolf Studio's Refusal To Pay Protection Money (2.135)", isJobID: 20, isCity: 12, isTab: 3},
			{isName: "Send A Warning To Jack Woolf Himself (2.073)", isJobID: 21, isCity: 12, isTab: 3},
			{isName: "Cause An Accident On Set (2.202)", isJobID: 22, isCity: 12, isTab: 3},
			{isName: "Accuse Woolf Of Poor Working Conditions (2.248)", isJobID: 23, isCity: 12, isTab: 3},
			{isName: "Incite Employees To Start A Riot (2.107)", isJobID: 24, isCity: 12, isTab: 3},
			{isName: "Refuse Jack Woolf's Apology (2.115)", isJobID: 25, isCity: 12, isTab: 3},
			{isName: "Make An Example Of Him (2.253)", isJobID: 26, isCity: 12, isTab: 3},
			{isName: "Continue Movie Production With Your New Man As Head (2.114)", isJobID: 27, isCity: 12, isTab: 3}		
		],
		D4:[
			{isName: "Head To Three Towers Correctional Facility (1.992)", isJobID: 28, isCity: 12, isTab: 4},
			{isName: "Discover You've Been Ambushed By A Rebel Gang (2.027)", isJobID: 29, isCity: 12, isTab: 4},
			{isName: "Get Rescued By The Shadowman (2.249)", isJobID: 30, isCity: 12, isTab: 4},
			{isName: "Agree To Break Out A Prisoner For Him (2.066)", isJobID: 31, isCity: 12, isTab: 4},
			{isName: "Lift A Chopper From The Airport (2.235)", isJobID: 32, isCity: 12, isTab: 4},
			{isName: "Launch An Assault On The Prison (2.253)", isJobID: 33, isCity: 12, isTab: 4},
			{isName: "Deliver The Prisoner To The Shadowman (2.180)", isJobID: 34, isCity: 12, isTab: 4},
			{isName: "Retrieve Information On Your Unknown Enemy (2.088)", isJobID: 35, isCity: 12, isTab: 4},
			{isName: "Learn That Your Henchman Has Gone Missing (2.264)", isJobID: 36, isCity: 12, isTab: 4}	
		],
		D5:[
			{isName: "Track Your Missing Henchman's Cellphone's Location (2.047)", isJobID: 37, isCity: 12, isTab: 5},
			{isName: "Assign Natasha To Pick Him Up (2.253)", isJobID: 38, isCity: 12, isTab: 5},
			{isName: "Learn That It Was A Trap After Her Narrow Escape (2.054)", isJobID: 39, isCity: 12, isTab: 5},
			{isName: "Receive A Threat To Back Off In Exchange For Your Henchman (2.007)", isJobID: 40, isCity: 12, isTab: 5},
			{isName: "Attempt To Trace Wayne's Captors (2.202)", isJobID: 41, isCity: 12, isTab: 5},
			{isName: "Find A Surprise Package On Your Doorstep (2.271)", isJobID: 42, isCity: 12, isTab: 5},
			{isName: "Go To Your Mob Doctor For An Autopsy (2.272)", isJobID: 43, isCity: 12, isTab: 5},
			{isName: "Discover that Your Deceased Henchman Left You A Tip-Off (2.088)", isJobID: 44, isCity: 12, isTab: 5},
			{isName: "Send The Chip For Analysis (2.281)", isJobID: 45, isCity: 12, isTab: 5}			
		],
		D6:[
			{isName: "Head Engineers In Setting Up City's Mainframe - AEGIS (2.136)", isJobID: 46, isCity: 12, isTab: 6},
			{isName: "Announce A Major Initiative To Increase AEGIS (1.970)", isJobID: 47, isCity: 12, isTab: 6},
			{isName: "Sell Vital Information For An Exorbitant Amount Of Money (2.283)", isJobID: 48, isCity: 12, isTab: 6},
			{isName: "Realize That A Jealous Coworker Snitched On You  (2.180)", isJobID: 49, isCity: 12, isTab: 6},
			{isName: "Try To Flee Arrest From The Secret Service (2.126)", isJobID: 50, isCity: 12, isTab: 6},
			{isName: "Discover That The Govt Has Handed You Over To Gang Justice (2.267)", isJobID: 51, isCity: 12, isTab: 6},
			{isName: "Escape With The Help Of A Few Loyal Friends (2.272)", isJobID: 52, isCity: 12, isTab: 6},
			{isName: "Vow To Avenge The Injustice You Faced (2.088)", isJobID: 53, isCity: 12, isTab: 6},
			{isName: "Draw Plans For Hivemind To Counterattack AEGIS (2.328)", isJobID: 54, isCity: 12, isTab: 6}
		],
		D7:[
			{isName: "Job 1 (0.00)", isJobID: 55, isCity: 12, isTab: 7},
			{isName: "Job 2 (0.00)", isJobID: 56, isCity: 12, isTab: 7},
			{isName: "Job 3 (0.00)", isJobID: 57, isCity: 12, isTab: 7},
			{isName: "Job 4 (0.00)", isJobID: 58, isCity: 12, isTab: 7},
			{isName: "Job 5 (0.00)", isJobID: 59, isCity: 12, isTab: 7},
			{isName: "Job 6 (0.00)", isJobID: 60, isCity: 12, isTab: 7},
			{isName: "Job 7 (0.00)", isJobID: 61, isCity: 12, isTab: 7},
			{isName: "Job 8 (0.00)", isJobID: 62, isCity: 12, isTab: 7},
			{isName: "Job 9 (0.00)", isJobID: 63, isCity: 12, isTab: 7}
		]
	};
	
	var StamJobs = new Array(
		{isName: "Gain The Cooperation Of Key Members Of Parliament (2.163)", isJobID: 91, isCity: 10, isTab: 10},
		{isName: "Double Cross And Have Them Eliminated (2.222)", isJobID: 94, isCity: 10, isTab: 10},
		{isName: "Offer Restitution To Terror Attack Victims (2.270)", isJobID: 97, isCity: 10, isTab: 10},
		{isName: "Send Your Partner To Make A Deal With The Police (2.168)", isJobID: 93, isCity: 11, isTab: 10},
		{isName: "Sabotage The Bull Pens To Create A Diversion (2.232)", isJobID: 95, isCity: 11, isTab: 10},
		{isName: "Use His Death To Instigate Riots Across The city (2.277)", isJobID: 98, isCity: 11, isTab: 10}
	);
	

	var isRunning = true;
	var JobMap = new Array(), jobArray = new Array(), JobsAdded = new Array();
	var SecretDistrictCounter = 0, SDMap = new Array();
	var ClickGo;
	
	var locationInfo = {
		1: {name: "New York", "number": 1, "districts": 9},
		7: {name: "Brazil", "number": 7, "districts": 8},
		8: {name: "Chicago", "number": 8, "districts": 6},
		9: {name: "London", "number": 9, "districts": 10},
//		10:{name: "South Africa", "number": 10, "districts": 10},
		11:{name: "Mexico", "number": 11, "districts": 11},
		12:{name: "Los Angeles", "number": 12, "districts": 3}
	};
	
	var minDiv = false;
	var SortLists = false;
	var banditInfo = {
		crewMembers: 0,
		Bandit_type: 0,
		Bandit_elim: 0,
		Bandit_timer: 0,
		banditsActive: false	
	}
	
	var seconds = 0;
	var minutes = 0;
	var hours = 0;
	
	var ajxreqs = [];
	var req_active = 0;
	var lag = 0;
	var err404 = 0;
	
	var DroneX = {
		Imgs:{
			FamilyIcon: 'https://zynga1-a.akamaihd.net/mwfb/mwfb/graphics/v3/family_icon_19x19pixels.png',
			EnergyIcon: 'https://zynga1-a.akamaihd.net/mwfb/mwfb/graphics/icon-energy.gif',
			StaminaIcon: 'http://mwfb.static.zynga.com/mwfb/graphics/icon_stamina_16x16_01.gif',
			ExpIcon: 'https://zynga1-a.akamaihd.net/mwfb/mwfb/graphics/icon_experience_16x16_01.gif',
			RubyStar: 'https://zynga1-a.akamaihd.net/mwfb/mwfb/graphics/icon_star_16x16_ruby_01.gif',
			GoldStar: 'https://zynga1-a.akamaihd.net/mwfb/mwfb/graphics/icon_star_16x16_gold_01.gif',
			SilverStar: 'https://zynga1-a.akamaihd.net/mwfb/mwfb/graphics/icon_star_16x16_silver_01.gif',
			BronzeStar: 'https://zynga1-a.akamaihd.net/mwfb/mwfb/graphics/icon_star_16x16_bronze_01.gif',
			NoneStar: '',
			ChestKey: 'https://zynga1-a.akamaihd.net/mwfb/mwfb/graphics/item_treasure_chest_key.gif',
			CashIcon: 'https://zynga1-a.akamaihd.net/mwfb/mwfb/graphics/icon_cash_16x16_01.gif',
			AttackIcon: 'https://zynga1-a.akamaihd.net/mwfb/mwfb/graphics/icon-attack.gif',
			DefenseIcon: 'http://mwfb.static.zynga.com/mwfb/graphics/icon-defense.gif',
			HealthIcon: 'http://mwfb.static.zynga.com/mwfb/graphics/icon-health.gif',
			En2xp: '',
			Iced: '',
			Killed: '',
			Loading: '',
			bCancer: ''
		},
		Settings:{
			BanditXPCheck: 1,
			BanditCSHCheck: 4,
			BanditJOBCheck: 1,
			BanditElapsedTimerXP: 4,
			BanditElapsedTimerCash: 4,
			NoResources: 1,
			SpendXYZWhen:0,
			SpendXYZ: 3,
			spendxyzPoints: 0,
			spendxyzKeep: 0,
			RestartTime: 1,
			BankAbove : 10,
			PowerJob: true,
			AutoStart: false,
			collectLevelUp: true,
			disableNYBank: true,
		//	buyCity10: false,
			buyCity11: false,
			buyCity12: false,
			BG: 6,
			isHiding: new Array()
		}
	};
		
	function create_div() {
		$('a[id^="travel_menu_secret_"]').each(function(){
			SecretDistrictCounter++;
			var isName = $(this).text().trim();
			var isLink = $(this).prop('onclick');
			var isTab = /tab=(\d+)/.exec(isLink)[1];
			var isCity = /destination=(\d+)/.exec(isLink)[1];
			var new_district = {isName:isName, isTab:isTab, isCity:isCity};
			SDMap.push(new_district);
		});	
		
		readSettings();
		
		var DroneX_Stylez = '<style type="text/css">'+
			'.DroneX_Box {float: left;overflow-x: hidden;width: 522px;}'+
			'.DroneX_TabBox {height: 27px;overflow: hidden;}'+
			'.DroneX_OptsBox{height: 27px;overflow: hidden;}'+
			'.DroneX_Tab {float: left;}'+
			'.DroneX_TabActive {opacity: 1;}'+
			'.DroneX_TabInActive {opacity: 0.7;}'+
			'.DroneX_TabStart {background: url("https://zynga1-a.akamaihd.net/mwfb/mwfb/graphics/black_tabs_left.png") no-repeat scroll 0 0 rgba(0, 0, 0, 0);float: left;height: 28px;width: 3px;}'+
			'.DroneX_TabMiddle {background: url("https://zynga1-a.akamaihd.net/mwfb/mwfb/graphics/black_tabs_slice.png") repeat scroll 0 0 rgba(0, 0, 0, 0);color: #FFFFFF;float: left;font-size: 14px;height: 28px;padding-left: 5px;padding-right: 10px;padding-top: 5px;}'+
			'.DroneX_TabEnd {background: url("https://zynga1-a.akamaihd.net/mwfb/mwfb/graphics/black_tabs_right.png") no-repeat scroll 0 0 rgba(0, 0, 0, 0);float: left;height: 28px;width: 3px;}'+
			'.DroneX_TabContent {background-color: #111111;border: 1px solid #666666;overflow: hidden;}'+
			'.DroneX_TabContentDiv {height: 230px;overflow: auto;}'+
			'.none_star {background: url("https://zynga1-a.akamaihd.net/mwfb/mwfb/graphics/map_based_jobs/mastery_stars_med_81x30_02.png") -15px -15px no-repeat; padding-left: 16px; font-size: 10px; display: inline-block; height: 15px;}'+
			'</style>';

		var ChangeLogInfoz = 'Change Log: <br><br>' +
			'<span class="good">[v0.09]</span> &nbsp; <span class="more_in">[22 May 2015]</span><br> - Added in Districts 6&7 for LA <br> - Removed South Africa :( <br><br>'+
			'<span class="good">[v0.08]</span> &nbsp; <span class="more_in">[13 May 2015]</span><br> - Added in Secret District Code. <br><br>'+		
			'<span class="good">[v0.07]</span> &nbsp; <span class="more_in">[17 April 2015]</span><br> - Added in Districts 4&5 for LA. <br><br>'+
			'<span class="good">[v0.06]</span> &nbsp; <span class="more_in">[05 April 2015]</span><br> - Change jobs when stopped <br> - Skillpoint spender. <br><br>'+
			'<span class="good">[v0.05]</span> &nbsp; <span class="more_in">[01 April 2015]</span><br> - Added in Runtime timer. <br> - Changed Logging system. <br><br>'+
			'<span class="good">[v0.04]</span> &nbsp; <span class="more_in">[29 March 2015]</span><br> - Added in Citystore buying. <br> - Added log colours. <br><br>'+
			'<span class="good">[v0.03]</span> &nbsp; <span class="more_in">[28 March 2015]</span><br> - Added in Banking. <br> - fixed a ratio/resource switching. <br><br>'+
			'<span class="good">[v0.02]</span> &nbsp; <span class="more_in">[27 March 2015]</span><br> - Added in most major things <br> - fixed a few bugs that people had reported. <br><br>'+
			'<span class="good">[v0.01]</span> &nbsp; <span class="more_in">[23 March 2015]</span><br> - Started.<br><br>';
		
		var MainIndexOf = '<div id="fb-root"></div>'+
'<div style="padding-bottom:20px;" class="empire_main_module"><div id="BGS" style="background-color: #000000;border: 1px solid #666666;border-radius: 3px 3px 3px 3px;color: #FFFFFF; width: 735px; height: auto; background: background-size: 100%;">'+
			'<div style="background: url(https://zynga1-a.akamaihd.net/mwfb/mwfb/graphics/empire/header_module_gradient.gif) repeat-x scroll 0 0 ;color: #FFCF01; font-size: 17px;font-weight: bold;height: 22px;width:725px; padding-left: 10px;padding-top: 10px;text-transform: uppercase;">Drone.&#12324; [BG] v0.09 <span id="hiddenStatus"></span>'+
				'<span style="float:right"> '+
					'<img id="minDiv" title="Be Tattas Aware!" style="padding-right: 10px;margin-top:-2px;width:12px;height:18px" src="' + DroneX.Imgs.bCancer + '"> '+
					'<a style="padding-right: 10px;margin-top:-14px;display:none;" class="sexy_button_new short orange" id="DxAS"><span><span> Autostarting... (stop) </span></span></a> '+
					'<a style="padding-right: 10px;margin-top:-14px;" class="sexy_button_new short green" id="start"><span><span>GO!</span></span></a> '+
					'<a href="#" style="padding-right: 10px;margin-top:-14px;display:none;" class="sexy_button_new short red" id="stop"><span><span>Stop</span></span></a> '+
					'<a href="#" style="padding-right: 10px;margin-top:-14px;" class="sexy_button_new short orange" id="close"><span><span><img src="https://zynga1-a.akamaihd.net/mwfb/mwfb/graphics/iced.png"></span></span></a> '+
				'</span>'+
			'</div>'+
			DroneX_Stylez+
			'<div style="width: 720px; padding: 0 7px; float: none; " class="DroneX_Box"> '+
				'<div style="display: none;" id="DroneX_stats"></div>'+
				'<div style="height: 35px; border-bottom: 1px solid #333;" class="DroneX_TabBox">	'+
					'<div style="margin-right: 3px; cursor: pointer; padding-top: 8px" class="DroneX_Tab DroneX_TabActive" id="DroneX_Tab_Main">'+
						'<div class="DroneX_TabStart">&nbsp;</div>'+
						'<div class="DroneX_TabMiddle">Main</div>'+
						'<div class="DroneX_TabEnd">&nbsp;</div>'+
					'</div>'+
					'<div style="margin-right: 3px; cursor: pointer; padding-top: 8px" class="DroneX_Tab DroneX_TabInActive" id="DroneX_Tab_Config">'+
						'<div class="DroneX_TabStart">&nbsp;</div>'+
						'<div class="DroneX_TabMiddle">Config</div>'+
						'<div class="DroneX_TabEnd">&nbsp;</div>'+
					'</div>'+
					'<div style="margin-right: 3px; cursor: pointer; padding-top: 8px" class="DroneX_Tab DroneX_TabInActive" id="DroneX_Tab_JobSetup">'+
						'<div class="DroneX_TabStart">&nbsp;</div>'+
						'<div class="DroneX_TabMiddle">Job Selection</div>'+
						'<div class="DroneX_TabEnd">&nbsp;</div>'+
					'</div>'+
					'<div style="margin-right: 3px; cursor: pointer; padding-top: 8px" class="DroneX_Tab DroneX_TabInActive" id="DroneX_Tab_JobList">'+
						'<div class="DroneX_TabStart">&nbsp;</div>'+
						'<div class="DroneX_TabMiddle">Job List</div>'+
						'<div class="DroneX_TabEnd">&nbsp;</div>'+
					'</div>'+
					'<div style="float:right; cursor: pointer; padding-top: 8px" class="DroneX_Tab DroneX_TabInActive" id="DroneX_Tab_ChangeLog">'+
						'<div class="DroneX_TabStart">&nbsp;</div>'+
						'<div class="DroneX_TabMiddle">Change Log</div>'+
						'<div class="DroneX_TabEnd">&nbsp;</div>'+
					'</div>'+						
				'</div>'+
				'<div style="background-color: transparent; border: none;" class="DroneX_TabContent">'+
					'<div style="overflow: hidden; height: auto; min-height:117px; margin-right: 0px; overflow-x: hidden;" class="DroneX_TabContentDiv">'+
						
						'<div id="DroneX_Div_Main">'+
							'<table style="border: 1px solid #666666; width:100%;">'+
								'<tr>'+
									'<td width="100%">'+
										'<div style="float: left; text-align: left">Last Levelup: <span id="LastLevelup" class="energy_highlight" style="font-weight: bold;">n/a</span></div>'+
										'<div style="float: right; text-align: right">Levelups: <span class="energy_highlight" id="Levelup" style="font-weight: bold;">0</span></div>'+
									'</td>'+
								'</tr>'+
								'<tr>'+
									'<td width="100%">'+
										'<div style="float: left; text-align: left">In Action: <span id="inAction" class="energy_highlight" style="font-weight: bold;">n/a</span></div>'+
										'<div style="float: right; text-align: right; display: none;"><span class="bad" id="banditAppeared"></span> </div>'+ 
									'</td>'+
								'</tr>'+
								'<tr>'+
									'<td width="100%">'+
										'<div style="float: left; text-align: left">Status: <span id="status" class="energy_highlight" style="font-weight: bold;">n/a</span></div>'+
									'</td>'+
								'</tr>'+
							'</table>'+	
							'<table style="border: 1px solid #666666; border-top:0px; width:100%;">'+
								'<tr>'+
									'<td width="100%">'+
										'<div style="float: left; text-align: left;">Job List:</div>'+
										'<div style="float: right; text-align: right; margin-right:5px;">City || Requires || Experience || Done</div>'+
									'</td>'+
								'</tr>'+
								'<tr>'+
									'<td width="100%">'+
										'<div style="float: left; text-align: left"><span id="JobList" class="energy_highlight">n/a</span></div>'+
									'</td>'+
								'</tr>'+	
							'</table>'+	
						'</div>'+
					
						'<div style="display: none;" id="DroneX_Div_Config">'+
							'<h3 style="text-align:center;">Drone.&#12324; Config</h3>'+
							'<fieldset>' + 
							'<legend>'+
									'<div style="height: 35px; border-bottom: 1px solid #333;" class="DroneX_OptsBox">'+
										'<div style="margin-right: 3px; cursor: pointer; padding-top: 8px" class="DroneX_Tab DroneX_TabActive" id="DroneX_Opt_Job">'+
											'<div class="DroneX_TabStart">&nbsp;</div>'+
											'<div class="DroneX_TabMiddle">Job/Bandit Options</div>'+
											'<div class="DroneX_TabEnd">&nbsp;</div>'+
										'</div>'+
/*										'<div style="margin-right: 3px; cursor: pointer; padding-top: 8px" class="DroneX_Tab DroneX_TabInActive" id="DroneX_Opt_Masterer">'+
											'<div class="DroneX_TabStart">&nbsp;</div>'+
											'<div class="DroneX_TabMiddle">Masterer</div>'+
											'<div class="DroneX_TabEnd">&nbsp;</div>'+
										'</div>'+*/
										'<div style="margin-right: 3px; cursor: pointer; padding-top: 8px" class="DroneX_Tab DroneX_TabInActive" id="DroneX_Opt_Bank">'+
											'<div class="DroneX_TabStart">&nbsp;</div>'+
											'<div class="DroneX_TabMiddle">Banking Options</div>'+
											'<div class="DroneX_TabEnd">&nbsp;</div>'+
										'</div>'+
										'<div style="margin-right: 3px; cursor: pointer; padding-top: 8px" class="DroneX_Tab DroneX_TabInActive" id="DroneX_Opt_SkillPoints">'+
											'<div class="DroneX_TabStart">&nbsp;</div>'+
											'<div class="DroneX_TabMiddle">Skill Points</div>'+
											'<div class="DroneX_TabEnd">&nbsp;</div>'+
										'</div>'+
										'<div style="margin-right: 3px; cursor: pointer; padding-top: 8px" class="DroneX_Tab DroneX_TabInActive" id="DroneX_Opt_Restart">'+
											'<div class="DroneX_TabStart">&nbsp;</div>'+
											'<div class="DroneX_TabMiddle">Restart</div>'+
											'<div class="DroneX_TabEnd">&nbsp;</div>'+
										'</div>'+
										'<div style="margin-right: 3px; cursor: pointer; padding-top: 8px" class="DroneX_Tab DroneX_TabInActive" id="DroneX_Opt_Misc">'+
											'<div class="DroneX_TabStart">&nbsp;</div>'+
											'<div class="DroneX_TabMiddle">Misc</div>'+
											'<div class="DroneX_TabEnd">&nbsp;</div>'+
										'</div>'+
									'</div>'+
									
		 
									
									//<select id="DX_Opts"><option value="0">Job/Bandit Options</option><option value="1">Banking Options</option><option value="2">Spending/Restart</option><option value="3">Misc</option></select>'+
							
							
								'</legend>' + 
							'<div id="DroneX_OptDiv_Job">'+
							/*'Job Speed&nbsp;<select id="ZX_jobSpeed" onChange="jobSpeedSelector(this.value)"><option value="0">Quick</option><option value="1">Fast</option><option value="2">Medium</option><option value="3">Slow</option></select>'+*/
							'Use Power Job <input type="checkbox" id="cPowerJob"/>'+
							'<br style="line-height: 30px;">'+
							'XP Bandit <select id="XPBanO" onChange="BanditXPCheck(this.selectedIndex)"><option value="0">Kill When Detected!</option><option value="1">Kill with 1 minute to go</option><option value="2">Kill with 2 minutes to go</option><option value="3">Kill with 3 minutes to go</option></select>'+
							'<br style="line-height: 30px;">'+
							'Cash Bandit <select id="CSHBanO" onChange="BanditCSHCheck(this.selectedIndex)"><option value="0">Kill When Detected!</option><option value="1">Kill with 1 minute to go</option><option value="2">Kill with 2 minutes to go</option><option value="3">Kill with 3 minutes to go</option><option value="4">Keep Jobbing Thru it</option></select>'+
							'<br style="line-height: 30px;">'+
							'Job Bandit <select id="JOBBanO" onChange="BanditJOBCheck(this.selectedIndex)"><option value="0">Kill When Detected!</option><option value="1">Wait it out!</option></select>'+
						//	'<br style="line-height: 30px;">'+
						//	'Stop if Mexico Boss is Active?&nbsp;<input type="checkbox" id="ZX_mexBossActive"/>'+
							'</div>'+ 
							
							
/*							'<div id="DroneX_OptDiv_Masterer" style="display: none;">'+
							'Nothing is mysteriously here..'+
							'</div>'+*/
							
							'<div id="DroneX_OptDiv_Bank" style="display: none;">'+
						//	'Banking options were all banked! So.. Nothing is mysteriously here..'+
							'AutoBank Above: <input id="DX_bankAbove" type="text" value="10" style="width:50px;" />'+
							'<br style="line-height: 30px;">'+
							'Disable Banking in NY&nbsp;<input type="checkbox" id="DX_disableNY"/>'+
							'<br style="line-height: 30px;">'+
							'Buy city store items in:<br style="line-height: 30px;">'+ 
							/*'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id="DX_buyCityStore_10"/>&nbsp;South Africa<br style="line-height: 30px;">'+
						*/	'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id="DX_buyCityStore_11"/>&nbsp;Mexico<br style="line-height: 30px;">'+
							'&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="checkbox" id="DX_buyCityStore_12"/>&nbsp;Los Angeles<br style="line-height: 30px;">'+

							'</div>'+
							// onChange="SkillSpending(this.value)"
							'<div id="DroneX_OptDiv_SkillPoints" style="display: none;">'+
							'When to apply skillpoints: <select id="DX_SpendxyzWhen"><option value="0">Never</option><option value="1">Every Levelup</option><option value="2">When out of Resources</option><option value="3">When X amount of points acquired </option></select><br style="line-height: 30px;">'+
							'<span style="display:none" id="DX_skillsSpan">'+
								'<span style="display:none" id="DX_skillsAcq">'+
									'Acquire <input id="DX_spendxyzPoints" type="text" value="1000" maxlength="4" style="width:30px;"/> skillpoints before spending them<br style="line-height: 30px;">'+
								'</span>'+	
								'What to Apply to: <select id="DX_Spendxyz"><option value="0">Attack</option><option value="1">Defense</option><option value="2">Health</option><option value="3">Energy</option><option value="4">Stamina</option></select><br style="line-height: 30px;">'+
								'Always Keep <input id="DX_spendxyzKeep" type="text" value="1000" maxlength="4" style="width:30px;"/> skillpoints<br style="line-height: 30px;">'+
							'</span>'+	
							/*'Apply <select id="DX_Spendxyz"><option value="0">No!</option><option value="1">Attack</option><option value="2">Defense</option><option value="3">Health</option><option value="4">Energy</option><option value="5">Stamina</option></select> Skillpoints<br style="line-height: 30px;">'+
							'<span style="display:none" id="DX_skillsSpan">'+
							'Attempt to Spend Skillpoints <select id="DX_SpendxyzWhen"><option value="0">when out of resources</option><option value="1">every levelup</option></select><br style="line-height: 30px;">'+
							'Spend skillpoints when you have <input id="DX_spendxyzPoints" type="text" value="1000" maxlength="4" style="width:30px;"/> points<br style="line-height: 30px;">'+
							'Always Keep <input id="DX_spendxyzKeep" type="text" value="1000" maxlength="4" style="width:30px;"/> skillpoints<br style="line-height: 30px;">'+
							'</span>'+*/
							'</div>'+							
							
							'<div id="DroneX_OptDiv_Restart" style="display: none;">'+
							'When out of resources: <select id="DX_noResources"><option value="0">Do Nothing!</option><option value="1">Restart</option></select>'+
							'<span style="display:none" id="DX_restartSpan">'+
							' In: <input id="DX_restartTime" type="text" value="1" maxlength="4" style="width:15px;"/> Minute<span id="ss"></span>. <span class="more_in">(Minimum: 1)</span></span>'+
							//'<br style="line-height: 30px;">'+
							//'Apply <select id="ZX_skillSpending" onChange="SkillSpending(this.value)"><option value="0">No!</option><option value="1">Attack</option><option value="2">Defense</option><option value="3">Health</option><option value="4">Energy</option><option value="5">Stamina</option></select> Skillpoints <span style="display:none" id="ZX_spendSkillsWhen"><select id="ZX_spendSkills"><option value="0">when out of resources</option><option value="1">every levelup</option></select></span>'+
							'</div>'+
							
							'<div id="DroneX_OptDiv_Misc" style="display: none;">'+
								'Collect Levelup Bonus <input type="checkbox" id="cLevelup"/>'+
								'<br style="line-height: 30px;">'+
								'AutoStart <input id="Dx_AutoStart" type="checkbox">'+	
								'<br style="line-height: 30px;">'+
								/*'Use Family XP to Level? <input type="checkbox" id=""/> <span class="more_in">(Not Yet Added)</span>'+
								'<br style="line-height: 30px;">'+
								'Stop at level <input id="" type="text" value="0" maxlength="6" style="width:45px;"/> <span class="more_in">(Not Yet Added)</span>'+
								'<br style="line-height: 30px;">'+
								'Heal when possible? (In NY) <input type="checkbox" id=""/> <span class="more_in">(Not Yet Added)</span>'+
								'<br style="line-height: 30px;">'+
								'Autostart <input type="checkbox" id=""/> (Autoruns when MW starts, will only work if you have GM version installed) <span class="more_in">(Not Yet Added)</span>'+
								'<br style="line-height: 30px;">'+
								'Debug For Sim is: Disabled <span class="more_in">(Not Yet Added)</span>'+
								'<br style="line-height: 30px;">'+
								'Adding Seconds Into Timestamp: <input type="checkbox" id=""/> <span class="more_in">(Not Yet Added)</span>'+
								'<br style="line-height: 30px;">'+*/
								'Background <select id="BGC" onChange="BGCheck(this.selectedIndex)"><option value="0">Mexico</option><option value="1">London</option><option value="2">Hydro</option><option value="3">OfficerJAKE Special</option><option value="4">OfficerJAKE Halloween Special</option><option value="5">Plain Black (No Background)	</option><option value="6">Los Angeles</option><option value="7">Transparent</option></select>'+
							'</div>'+
							
							'</fieldset>'+
						'</div>'+
						
						
						
						
						'<div style="display: none;" id="DroneX_Div_JobSetup">'+
							'<center><a id="Show_Opt_Energy" class="sexy_button_new green short"><span><span><img src="https://zynga1-a.akamaihd.net/mwfb/mwfb/graphics/icon-energy.gif"> Energy</span></span></a>&nbsp;<a id="Show_Opt_Stamina" class="sexy_button_new short red"><span><span><img src="http://mwfb.static.zynga.com/mwfb/graphics/icon_stamina_16x16_01.gif"> Stamina</span></span></a>'+//&nbsp;<a id="Show_Opt_Masterer" class="sexy_button_new short black"><span><span><img src="http://mwfb.static.zynga.com/mwfb/graphics/icon_influence_16x16_01.gif"> Masterer</span></span></a>
							'</center>'+
							'<span id="Energy_Opt" style="display:none">'+
							'<center>'+
							'Add the jobs you wish to perform...<br>'+
							'<a id="Show_Location_NY" class="sexy_button_new black short"><span><span>New York</span></span></a>&nbsp;'+
							'<a id="Show_Location_BRL" class="sexy_button_new black short"><span><span>Brazil</span></span></a>&nbsp;'+
							'<a id="Show_Location_CHI" class="sexy_button_new black short"><span><span>Chicago</span></span></a>&nbsp;'+
							'<a id="Show_Location_LON" class="sexy_button_new black short"><span><span>London</span></span></a>&nbsp;'+
						//	'<a id="Show_Location_SA" class="sexy_button_new black short"><span><span>South Africa</span></span></a>&nbsp;'+
							'<a id="Show_Location_MEX" class="sexy_button_new black short"><span><span>Mexico</span></span></a>&nbsp;'+
							'<a id="Show_Location_LA" class="sexy_button_new black short"><span><span>Los Angeles</span></span></a>&nbsp;'+
							'<a class="sexy_button_new black short orange" id="Show_Location_LT"><span><span>Limited Time</span></span></a>'+
							'</center>'+
						'<br>'+
						'<div id="Location_NY" style="display:none">'+
						'<center>';
						for(i = 1; i < Object.keys(NYJobMap).length+1; i++){
							MainIndexOf += ' <a class="sexy_button_new purple short"><span><span id="ShowHide_NY_'+i+'">D'+i+'</span></span></a> '
						}
						MainIndexOf += '</center>';
						for(i = 0; i < Object.keys(NYJobMap).length; i++){
							MainIndexOf += '<div id="City_NY_'+(i+1)+'" style="display:none">';
							for (ii = 0; ii < NYJobMap[Object.keys(NYJobMap)[i]].length; ii++) {
								MainIndexOf += '<li style="clear:both;list-style-type: none;"><span style="background: none repeat scroll 0 0 #111111;border: 1px solid #333333;height: 30px;width:660px;float:left;position:relative;left:5%;"><div style="margin-top:5px;">' + NYJobMap[Object.keys(NYJobMap)[i]][ii].isName + ' <span style="float:right;margin:-2px;margin-right:5px;"><a id="ADD_NYCJOB" class="sexy_button_new short green"><span><span id="NY_'+(i+1)+'_' + ii + '">Add</span></span></a></span></div></span></li>'
							}
							MainIndexOf += '</div>';
						}
						MainIndexOf += '</div>'+//end ny
						'<div id="Location_BRL" style="display:none">'+
						'<center>';
						for(i = 1; i < Object.keys(BRLJobMap).length+1; i++){
							MainIndexOf += ' <a class="sexy_button_new purple short"><span><span id="ShowHide_BRL_'+i+'">D'+i+'</span></span></a> '
						}
						MainIndexOf += '</center>';
						for(i = 0; i < Object.keys(BRLJobMap).length; i++){
							MainIndexOf += '<div id="City_BRL_'+(i+1)+'" style="display:none">';
							for (ii = 0; ii < BRLJobMap[Object.keys(BRLJobMap)[i]].length; ii++) {
								MainIndexOf += '<li style="clear:both;list-style-type: none;"><span style="background: none repeat scroll 0 0 #111111;border: 1px solid #333333;height: 30px;width:660px;float:left;position:relative;left:5%;"><div style="margin-top:5px;">' + BRLJobMap[Object.keys(BRLJobMap)[i]][ii].isName + ' <span style="float:right;margin:-2px;margin-right:5px;"><a id="ADD_BRLJOB" class="sexy_button_new short green"><span><span id="BRL_'+(i+1)+'_' + ii + '">Add</span></span></a></span></div></span></li>'
							}
							MainIndexOf += '</div>';
						}
						MainIndexOf += '</div>'+//end brl
						'<div id="Location_CHI" style="display:none">'+
						'<center>';
						for(i = 1; i < Object.keys(CHIJobMap).length+1; i++){
							MainIndexOf += ' <a class="sexy_button_new purple short"><span><span id="ShowHide_CHI_'+i+'">D'+i+'</span></span></a> '
						}
						MainIndexOf += '</center>';
						for(i = 0; i < Object.keys(CHIJobMap).length; i++){
							MainIndexOf += '<div id="City_CHI_'+(i+1)+'" style="display:none">';
							for (ii = 0; ii < CHIJobMap[Object.keys(CHIJobMap)[i]].length; ii++) {
								MainIndexOf += '<li style="clear:both;list-style-type: none;"><span style="background: none repeat scroll 0 0 #111111;border: 1px solid #333333;height: 30px;width:660px;float:left;position:relative;left:5%;"><div style="margin-top:5px;">' + CHIJobMap[Object.keys(CHIJobMap)[i]][ii].isName + ' <span style="float:right;margin:-2px;margin-right:5px;"><a id="ADD_CHIJOB" class="sexy_button_new short green"><span><span id="CHI_'+(i+1)+'_' + ii + '">Add</span></span></a></span></div></span></li>'
							}
							MainIndexOf += '</div>';
						}
						MainIndexOf += '</div>'+//end CHI
						'<div id="Location_LON" style="display:none">'+
						'<center>';
						for(i = 1; i < Object.keys(LONJobMap).length+1; i++){
							MainIndexOf += ' <a class="sexy_button_new purple short"><span><span id="ShowHide_LON_'+i+'">D'+i+'</span></span></a> '
						}
						MainIndexOf += '</center>';
						for(i = 0; i < Object.keys(LONJobMap).length; i++){
							MainIndexOf += '<div id="City_LON_'+(i+1)+'" style="display:none">';
							for (ii = 0; ii < LONJobMap[Object.keys(LONJobMap)[i]].length; ii++) {
								MainIndexOf += '<li style="clear:both;list-style-type: none;"><span style="background: none repeat scroll 0 0 #111111;border: 1px solid #333333;height: 30px;width:660px;float:left;position:relative;left:5%;"><div style="margin-top:5px;">' + LONJobMap[Object.keys(LONJobMap)[i]][ii].isName + ' <span style="float:right;margin:-2px;margin-right:5px;"><a id="ADD_LONJOB" class="sexy_button_new short green"><span><span id="LON_'+(i+1)+'_' + ii + '">Add</span></span></a></span></div></span></li>'
							}
							MainIndexOf += '</div>';
						}
						MainIndexOf += '</div>'+//end LON
/*						'<div id="Location_SA" style="display:none">'+
						'<center>';
						for(i = 1; i < Object.keys(SAJobMap).length+1; i++){
							MainIndexOf += ' <a class="sexy_button_new purple short"><span><span id="ShowHide_SA_'+i+'">D'+i+'</span></span></a> '
						}
						MainIndexOf += '</center>';
						for(i = 0; i < Object.keys(SAJobMap).length; i++){
							MainIndexOf += '<div id="City_SA_'+(i+1)+'" style="display:none">';
							for (ii = 0; ii < SAJobMap[Object.keys(SAJobMap)[i]].length; ii++) {
								MainIndexOf += '<li style="clear:both;list-style-type: none;"><span style="background: none repeat scroll 0 0 #111111;border: 1px solid #333333;height: 30px;width:660px;float:left;position:relative;left:5%;"><div style="margin-top:5px;">' + SAJobMap[Object.keys(SAJobMap)[i]][ii].isName + ' <span style="float:right;margin:-2px;margin-right:5px;"><a id="ADD_SA1JOB" class="sexy_button_new short green"><span><span id="SA_'+(i+1)+'_' + ii + '">Add</span></span></a></span></div></span></li>'
							}
							MainIndexOf += '</div>';
						}
						MainIndexOf += '</div>'+//end SA*/
						'<div id="Location_MEX" style="display:none">'+
						'<center>';
						for(i = 1; i < Object.keys(MEXJobMap).length+1; i++){
							MainIndexOf += ' <a class="sexy_button_new purple short"><span><span id="ShowHide_MEX_'+i+'">D'+i+'</span></span></a> '
						}
						MainIndexOf += '</center>';
						for(i = 0; i < Object.keys(MEXJobMap).length; i++){
							MainIndexOf += '<div id="City_MEX_'+(i+1)+'" style="display:none">';
							for (ii = 0; ii < MEXJobMap[Object.keys(MEXJobMap)[i]].length; ii++) {
								MainIndexOf += '<li style="clear:both;list-style-type: none;"><span style="background: none repeat scroll 0 0 #111111;border: 1px solid #333333;height: 30px;width:660px;float:left;position:relative;left:5%;"><div style="margin-top:5px;">' + MEXJobMap[Object.keys(MEXJobMap)[i]][ii].isName + ' <span style="float:right;margin:-2px;margin-right:5px;"><a id="ADD_MEXJOB" class="sexy_button_new short green"><span><span id="MEX_'+(i+1)+'_' + ii + '">Add</span></span></a></span></div></span></li>'
							}
							MainIndexOf += '</div>';
						}
						MainIndexOf += '</div>'+//end MEX
						'<div id="Location_LA" style="display:none">'+
						'<center>';
						for(i = 1; i < Object.keys(LAJobMap).length+1; i++){
							MainIndexOf += ' <a class="sexy_button_new purple short"><span><span id="ShowHide_LA_'+i+'">D'+i+'</span></span></a> '
						}
						MainIndexOf += '</center>';
						for(i = 0; i < Object.keys(LAJobMap).length; i++){
							MainIndexOf += '<div id="City_LA_'+(i+1)+'" style="display:none">';
							for (ii = 0; ii < LAJobMap[Object.keys(LAJobMap)[i]].length; ii++) {
								MainIndexOf += '<li style="clear:both;list-style-type: none;"><span style="background: none repeat scroll 0 0 #111111;border: 1px solid #333333;height: 30px;width:660px;float:left;position:relative;left:5%;"><div style="margin-top:5px;">' + LAJobMap[Object.keys(LAJobMap)[i]][ii].isName + ' <span style="float:right;margin:-2px;margin-right:5px;"><a id="ADD_LA1JOB" class="sexy_button_new short green"><span><span id="LA_'+(i+1)+'_' + ii + '">Add</span></span></a></span></div></span></li>'
							}
							MainIndexOf += '</div>';
						}
						MainIndexOf += '</div>'+//end LA
						'<div id="Location_LT" style="display:none">';
						if(SecretDistrictCounter > 0){
							for (i = 0; i < SecretDistrictCounter; i++) {
								MainIndexOf += '<a class="sexy_button_new short orange" id="'+SDMap[i].isTab+'"><span><span>'+SDMap[i].isName+'</span></span></a> <a id="GrabSD_'+i+'" class="sexy_button_new short black" style=""><span><span><img src="https://zynga1-a.akamaihd.net/mwfb/mwfb/graphics/action_box_icon_refresh.gif"></span></span></a><br><div id="'+SDMap[i].isTab+'_Jobs"></div>'
							}
						}else{
							MainIndexOf += 'No Secret District(s) detected, try reloading MW!'
						}
						MainIndexOf += '</div></span>'+//end LT
						'<span id="Stamina_Opt" style="display:none">'+
					/*	'<a class="sexy_button_new short red"><span><span> South Africa </span></span></a>';
						for (i = 0; i < Object.keys(StamJobs)[3]; i++) {
							MainIndexOf += '<li style="clear:both;list-style-type: none;"><span style="background: none repeat scroll 0 0 #111111;border: 1px solid #333333;height: 30px;width:670px;float:left;"><div style="margin-top:5px;">' + StamJobs[i].isName + ' <span style="float:right;margin:-2px;margin-right:5px;"><a id="ADD_FOBJOB" class="sexy_button_new short green"><span><span id="SA_10_' + i + '">Add</span></span></a></span></div></span></li>'
						}*/
					//	MainIndexOf += '<br><br><a class="sexy_button_new short red"><span><span> Mexico </span></span></a>';
						'<a class="sexy_button_new short red"><span><span> Mexico </span></span></a>';
						for (i = 3; i < StamJobs.length; i++) {
							MainIndexOf += '<li style="clear:both;list-style-type: none;"><span style="background: none repeat scroll 0 0 #111111;border: 1px solid #333333;height: 30px;width:670px;float:left;"><div style="margin-top:5px;">' + StamJobs[i].isName + ' <span style="float:right;margin:-2px;margin-right:5px;"><a id="ADD_FOBJOB" class="sexy_button_new short green"><span><span id="MEX_10_' + i + '">Add</span></span></a></span></div></span></li>'
						}
						MainIndexOf += ''+
						'</span>'+
						/*'<span id="Masterer_Opt" style="display:none">'+
						'Nothing is mysteriously here..'+
						'</span>'+*/
						'</div>'+
					'<div style="display: none;" id="DroneX_Div_JobList">'+
						'<center><a style="width:400px;" class="sexy_button_new short green"><span><span>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<img src="'+DroneX.Imgs.EnergyIcon+'"> Resource Options <img src="'+DroneX.Imgs.StaminaIcon+'"></span></span></a> <a id="dragEm" class="sexy_button_new short black" style=""><span><span><img src="https://zynga1-a.akamaihd.net/mwfb/mwfb/graphics/quest/toughguy-icon.png" style="height:20px;width:20px;"></span></span></a></center>'+
						'<ul id="customjobs"></ul>'+
						'</div>'+
						 '<div style="display: none; text-size:15px;" id="DroneX_Div_ChangeLog">'+
							ChangeLogInfoz+
						'</div>'+
					'</div>'+
					'<span id="rTime"></span>'+
					//'<span id="lastspan" class="energy_highlight" style="float:right">&nbsp;</span>'+
				//	'<span id="lastspan" class="energy_highlight" style="float:right"><b>Powered by $.Woof()</b></span>'+				
				'</div>'+
			'</div>'+
			'<div style="width: 720px; padding: 0 7px; float: none; " class="DroneX_Box"> '+
				'<div style="height: 35px; border-bottom: 1px solid #333;" class="DroneX_TabBox">	'+
					'<div style="margin-right: 3px; cursor: pointer; padding-top: 8px" class="DroneX_Tab DroneX_TabInActive" id="DroneX_TabLog_Looted">'+
						'<div class="DroneX_TabStart">&nbsp;</div>'+
						'<div class="DroneX_TabMiddle">Looted</div>'+
						'<div class="DroneX_TabEnd">&nbsp;</div>'+
					'</div>'+
					'<div style="margin-right: 3px; cursor: pointer; padding-top: 8px" class="DroneX_Tab DroneX_TabActive" id="DroneX_TabLog_Main">'+
						'<div class="DroneX_TabStart">&nbsp;</div>'+
						'<div class="DroneX_TabMiddle">Log</div>'+
						'<div class="DroneX_TabEnd">&nbsp;</div>'+
					'</div>'+
					'<div style="margin-right: 3px; cursor: pointer; padding-top: 8px" class="DroneX_Tab DroneX_TabInActive" id="DroneX_TabLog_Levelups">'+
						'<div class="DroneX_TabStart">&nbsp;</div>'+
						'<div class="DroneX_TabMiddle">Levelups</div>'+
						'<div class="DroneX_TabEnd">&nbsp;</div>'+
					'</div>'+		
				'</div>'+
				'<div style="background-color: transparent; border: none;" class="DroneX_TabContent">'+
					'<div style="overflow: hidden; height: auto; min-height:26px; margin-right: 0px; overflow-x: hidden;" class="DroneX_TabContentDiv">'+
						
						'<div style="display: none; overflow-y: auto;border-bottom: 1px solid #666666; max-height: 115px;" id="DroneX_Log_Looted" >'+
							'<table style="border: 1px solid #666666; width:100%;border-bottom:0px">'+
								'<tr>'+
									'<td width="100%">'+
										'<span id="loot_log"></span>'+
									'</td>'+
								'</tr>'+
							'</table>'+	
						'</div>'+
					
						'<div id="DroneX_Log_Main">'+
							'<table style="border: 1px solid #666666; width:100%;">'+
								'<tr>'+
									'<td width="50px" valign="top"><a href="#" id="log_show">Log</a> <input type="text" id="log_size" value="15" class="sexy_input" style="width:16px"></input></td>'+
									'<td width="1px" valign="top">:</td>' +
									'<td id="log" valign="top" colspan="2">DroneX Loaded...</td>'+
								'</tr>'+
							'</table>'+
						'</div>'+
						
						'<div style="display: none; overflow-y: auto;border-bottom: 1px solid #666666; max-height: 115px;" id="DroneX_Log_Levelups">'+
							'<table style="border: 1px solid #666666; width:100%;border-bottom:0px">'+
								'<tr>'+
									'<td width="100%">'+
										'<span id="levelup_log"> </span>'+
									'</td>'+
								'</tr>'+
							'</table>'+	
						'</div>'+
					'</div>'+
					'<span id="lastspan" class="energy_highlight" style="float:right">&nbsp;</span>'+
				'</div>'+
			'</div>'+
		'</div> <span style="font-weight: bold;" class="energy_highlight" id="minDiv_1">Feedback? Errors?</span> <span id="minDiv_2"><span><img src="https://zynga1-a.akamaihd.net/mwfb/mwfb/graphics/inventory/NAV/Inventory-wishlist-icon.png" style="vertical-align: -2px;"></span></span><a  id="minDiv_3" target="_blank" href="https://www.facebook.com/messages/john.xsseu" style="font-weight: bold;">Facebook Message Me!</a><span style="float:right;margin-right:8px">'+
		'<img  id="minDiv_4" title="Made & tested on FireFox" style="width:20px;height:20px;vertical-align:bottom;" src="http://upload.wikimedia.org/wikipedia/en/e/e3/Firefox-logo.svg"> '+
		'<a target="_blank" id="minDiv_5" href="https://www.facebook.com/officerjakewebdesign" style="font-weight: bold;">Officerjake - Web Design</a></span></div>';			
			
		
		//<span class="energy_highlight" style="float:right; font-weight: bold;">OfficerJAKE WebDesign</span>
		
		if(document.getElementById('gxDiv')) {
			document.getElementById('gxDiv').innerHTML = MainIndexOf;
		} else {
			var gxDiv=document.createElement("div");
			gxDiv.id = 'gxDiv';
			var content=document.getElementById('content_row');
			content.insertBefore(gxDiv, content.firstChild);
			document.getElementById('gxDiv').innerHTML = MainIndexOf;
		}
		
		
		$('#minDiv').click(function(){
			if(!minDiv){
				$('.DroneX_Box').hide();
				$('[id^="minDiv_"]').hide();
				$('#hiddenStatus').show();
				//width:35px
			/*	$('#minDiv > img').css("width", "35")
				$('#minDiv > img').css("height", "")
				$('#minDiv > img').attr('src','https://zynga1-a.akamaihd.net/mwfb/mwfb/graphics/marketplace/pawnshopTutorial/green-arrow-down.png');*/
				minDiv = true;
			}else{
				$('.DroneX_Box').show();
				$('[id^="minDiv_"]').show();
				$('#hiddenStatus').hide();
				//height:29px
			/*	$('#minDiv > img').css("width", "")
				$('#minDiv > img').css("height", "29")
				$('#minDiv > img').attr('src','https://zynga1-a.akamaihd.net/mwfb/mwfb/graphics/marketplace/pawnshopTutorial/green-arrow-right.png');*/
				minDiv = false;
			}
		});
		
		$('div[id^="DroneX_Tab_"]').click(function(){
			if($(this).hasClass('gxDisabled')){
				return false;
			}
			$('div[id^="DroneX_Tab_"]').removeClass('DroneX_TabActive').addClass('DroneX_TabInActive');
			$('#'+$(this).attr('id')).removeClass('DroneX_TabInActive').addClass('DroneX_TabActive');	
			$('div[id^="DroneX_Div_"]').hide();
			$('#rTime').hide();
			$('.DroneX_Box:last').hide();
			$('#DroneX_Div_'+$(this).attr('id').split('_')[2]).show();
			if($(this).attr('id').split('_')[2] == 'Main'){
				$('#rTime').show();
				$('.DroneX_Box:last').show();
			}
		})
		
		$('div[id^="DroneX_TabLog_"]').click(function(){
			if($(this).hasClass('gxDisabled')){
				return false;
			}
			$('div[id^="DroneX_TabLog_"]').removeClass('DroneX_TabActive').addClass('DroneX_TabInActive');
			$('#'+$(this).attr('id')).removeClass('DroneX_TabInActive').addClass('DroneX_TabActive');	
			$('div[id^="DroneX_Log_"]').hide();
			$('#DroneX_Log_'+$(this).attr('id').split('_')[2]).show();
		})		
		
		$('div[id^="DroneX_Opt_"]').click(function(){
			if($(this).hasClass('gxDisabled')){
				return false;
			}
			$('div[id^="DroneX_Opt_"]').removeClass('DroneX_TabActive').addClass('DroneX_TabInActive');
			$('#'+$(this).attr('id')).removeClass('DroneX_TabInActive').addClass('DroneX_TabActive');	
			$('div[id^="DroneX_OptDiv_"]').hide();
			$('#DroneX_OptDiv_'+$(this).attr('id').split('_')[2]).show();
		}) 
		
		$('a[id^="Show_Opt_"]').click(function(){
			if($('#'+$(this).attr('id').split('_')[2]+'_Opt').css('display') !== 'none'){
				$('#'+$(this).attr('id').split('_')[2]+'_Opt').hide();
				return;
			}else{
				$("span[id$='_Opt']").hide();
				$('#'+$(this).attr('id').split('_')[2]+'_Opt').show();
			}
		})
	
		$('a[id^="Show_Location_"]').click(function(){
			if($('#Location_'+$(this).attr('id').split('_')[2]).css('display') !== 'none'){
				$('a[id^="Show_Location_"]').removeClass('white').addClass('black');
				$('div[id^="Location_"]').hide();
				return;
			}else{
				$('div[id^="Location_"]').hide();
				$('a[id^="Show_Location_"]').removeClass('white').addClass('black');
				if($(this).attr('id').split('_')[2] !== 'LT'){
					$('#Show_Location_'+$(this).attr('id').split('_')[2]).addClass('white');
				}
				$('#Location_'+$(this).attr('id').split('_')[2]).show();
			}
		})
		
		$('span[id^="ShowHide_"]').click(function(){
			if($('#City_'+$(this).attr('id').split('_')[1]+'_'+$(this).attr('id').split('_')[2]).css('display') !== 'none'){
				$('#City_'+$(this).attr('id').split('_')[1]+'_'+$(this).attr('id').split('_')[2]).hide();
			}else{
				$('div[id^="City_"]').hide();
				$('#City_'+$(this).attr('id').split('_')[1]+'_'+$(this).attr('id').split('_')[2]).show();
			}
		})
		
		$('a[id^="GrabSD_"]').click(function(){
			var grabbedID = $(this).attr('id').split('_')[1];
			document.getElementById(SDMap[grabbedID].isTab+'_Jobs').innerHTML = '';
			AjxRequestBuilder('xw_controller=travel&xw_action=travel&from=job&destination='+SDMap[$(this).attr('id').split('_')[1]].isCity+'&tab='+SDMap[$(this).attr('id').split('_')[1]].isTab,function(page){
				$(page).find('.job').each(function(index){
					var GetName = $(this).find('h4').text().trim();
					var energy = $(this).find('.uses.clearfix').find('.energy').attr('current_value');
					var experience = $(this).find('.pays.clearfix').find('.experience').attr('current_value');
					var link = $(this).find('a[id^="btn_dojob_"]').attr('href');
					var jobidz = /job=(\d+)/.exec(link)[1];
					$('#'+SDMap[grabbedID].isTab+'_Jobs').append('<li style="clear:both;list-style-type: none;"><span style="background: none repeat scroll 0 0 #111111;border: 1px solid #333333;height: 30px;width:570px;float:left;"><div style="margin-top:5px;">' + GetName + ' ('+(experience/energy).toFixed(3)+')<span style="float:right;margin:-2px;margin-right:5px;"><a id="ADD_LTDJOB" class="sexy_button_new short green"><span><span id="LTD_'+SDMap[grabbedID].isCity+'_'+SDMap[grabbedID].isTab+'_' + jobidz + '">Add</span></span></a></span></div></span></li>')
				});
	//			logit(JSON.stringify(Zangano.SD, null, 0))
			});
		})

		$('a[id^="ADD_"]').live('click',function(){
			if($('ul#customjobs li a[id*="'+$(this).children().children().attr('id')+'"]').length > 0 && $('ul#customjobs li:contains("'+$(this).parent().parent().get(0).firstChild.nodeValue+'")').text()) {
				$(this).removeClass('red').addClass('green');
				$(this).children().children().text('Add');
				$('ul#customjobs li:contains("'+$(this).parent().parent().get(0).firstChild.nodeValue+'")').remove();
			}else{
				$('#customjobs').append($('<li style="clear:both;list-style-type: none;height:36px;"></li>').html('<span style="background: none repeat scroll 0 0 #111111;border: 1px solid #333333;height: 24px;width:570px;float:left;">'+$(this).parent().parent().get(0).firstChild.nodeValue+' <span style="float:right;margin:3px;"><a href="#" class="clearitem" id="'+this.id+'_'+$(this).children().children().attr('id')+'">X</a></span></span><a title="Add/Remove Options" id="JobEnergyTill"><img src="https://zynga1-a.akamaihd.net/mwfb/mwfb/graphics/inventory/NAV/Inventory-wishlist-icon.png" style="margin:7px;"></a><a title="Add/Remove Options" id="JobRatios"><img src="https://zynga1-a.akamaihd.net/mwfb/mwfb/graphics/v3/target_daily_take_icon.png" style="margin:4px;"></a><span style="display:none; background: none repeat scroll 0 0 #111111;border: 1px solid #333333;height: 24px;width:336px;float:left;">Change to next job when resource is under:<input type="integer" style="resize:none;width:50px;" value="100000"></span><span style="display:none; background: none repeat scroll 0 0 #111111;border: 1px solid #333333;height: 24px;width:291px;float:left;">Change to next job when ratio is under:<input type="integer" style="resize:none;width:30px;" value="2.27"></span>'));
				$(this).removeClass('green').addClass('red');
				$(this).children().children().text('Remove It');
			}
		});
		
		$("#JobEnergyTill").live('click',function(){
			$(this).parent().children().last().hide();
			$(this).parent().children().last().prev().toggle();
			return false;
		});
			
		$("#JobRatios").live('click',function(){
			$(this).parent().children().last().prev().hide();
			$(this).parent().children().last().toggle();
			return false;
		});
		
		$('.clearitem').live('click',function(){
			if(/(Gain The Cooperation|Double Cross And|Offer Restitution|Send Your Partner|Sabotage The Bull|Use His Death)/.test($(this).parent().parent().get(0).firstChild.nodeValue)){
				$('#ADD_FOBJOB #'+$(this).attr('id').substring(11)).parent().parent().removeClass('red').addClass('green');
				$('#ADD_FOBJOB #'+$(this).attr('id').substring(11)).text('Add');			
			}else{
				$("#"+$(this).attr('id').substring(11)).parent().parent().removeClass('red').addClass('green');
				$("#"+$(this).attr('id').substring(11)).text('Add');
			}
			$(this).parent().parent().parent().next("span").remove();		
			$(this).parent().parent().parent().remove();	
			return false;
		});
	}
	
	create_div();

	$('#stop').click(function(){
		if(isRunning){
			$('#stop').html('<span><span>GO!!!!</span></span>');
			$('#banditAppeared').parent().hide();
			clearTimeout(restartInterval);
			clearTimeout(runTimeInterval);
			$('#inAction').html('<span class="bad">Stopped</span>');
			var text1 = $('#DroneX_Tab_JobSetup .DroneX_TabMiddle').text()
			$('#DroneX_Tab_JobSetup .DroneX_TabMiddle').html(text1)
			$('#DroneX_Tab_JobSetup').removeClass('gxDisabled').attr("title","")
			var text2 = $('#DroneX_Tab_JobList .DroneX_TabMiddle').text()
			$('#DroneX_Tab_JobList .DroneX_TabMiddle').html(text2)
			$('#DroneX_Tab_JobList').removeClass('gxDisabled').attr("title","")
			$(this).addClass('green');
			$(this).removeClass('red');
			SkillSpendingInProgress = false;
			dolog('<span class="bad">Stopping...</span>', true) 		
			isRunning = false;
		}else{
			$('#stop').html('<span><span>Stop!</span></span>');
			dolog('Starting..', true);
			clearTimeout(restartInterval);
			//runTimeInterval = setInterval(runTimer, 1000);
			$(this).addClass('red');
			$(this).removeClass('green');
			/*var reset = false;
			for(var i = 0; i < JobMap.length; i++){
				for(var j = 0; j < JobsAdded.length; j++){
					if(JobMap[i].isID == JobsAdded[j].isID && JobMap[i].isCity == JobsAdded[j].isCity){
						if(JobsAdded[j].counter > JobMap[i].counter){
							JobMap[i].counter = JobsAdded[j].counter;
						}else{
							JobsAdded[j].counter = JobMap[i].counter;
						}
					}
				}		
			}
			
			var count = 0;
			$('#customjobs li a').each(function(){
				if($(this).attr('id') == 'JobRatios' || $(this).attr('id') == 'JobEnergyTill'){
					return true;
				}
				count++
			})
			
			function same(a,b){
				var same = JobMap.length === count, len;
				if(!same){ 
					reset = false 
				}else{
					reset = true;
					len = a.length;
					for(var i=0;reset !== false && i < len; i++) {
						if(a[i] !== b[i]) {
							reset = false;
						}
					}
				}
				return reset;
			}
			
			if(!reset){
			}else{
				
			}*/
			isRunning = true;
			$('#start').click();
//			setTimeout(function(){checkUserStats();},1000);
		}
		return false;
	});
	
	$("#DX_Opts").change(function () {
		UpdateConfig(this.value);
	})
	
	$('#dragEm').click(function(){
		if(!SortLists){
			$('#customjobs').sortable();
			$('#customjobs').disableSelection();	
			$(this).removeClass('black').addClass('red');
			SortLists = true;
		}else{
			$(this).removeClass('red').addClass('black');
			$('#customjobs').sortable('destroy');
			$('#customjobs').enableSelection();
			SortLists = false;
		}
	});
	
/*	$('#JobList').parent().hover(
		function () {
			$(this).css("overflow","auto");
			$(this).css("padding-right","1px");
		}, 
		function () {
			$(this).css("overflow","hidden");
			$(this).css("padding-right","");
		}
	);	*/
	
	$('#close').click(function(){
		$('#gxDiv').remove();
	});
	
/*	function UpdateConfig(value) {
		var value = parseInt(value);
		value === 0 ? $("#DX_Job_Opts").show() : $("#DX_Job_Opts").hide(),
		value === 1 ? $("#DX_Bank_Opts").show() : $("#DX_Bank_Opts").hide(), 
		value === 2 ? $("#DX_Spending_Opts").show() : $("#DX_Spending_Opts").hide(), 
		value === 3 ? $("#DX_Misc_Opts").show() : $("#DX_Misc_Opts").hide()
	}
	
	UpdateConfig(document.getElementById("DX_Opts").selectedIndex);*/
		
		
	var BGCheck = function(n){
		if (DroneX.Settings.BG != n){
			DroneX.Settings.BG = n;
		}
		writeSettings();
		switch(parseInt(n)){
			case 0:
				document.getElementById('BGS').style.background = 'url(https://zynga1-a.akamaihd.net/mwfb/mwfb/graphics/empire/mexico_hp_bg.jpg)  no-repeat'; 
			break;
			case 1:
				document.getElementById('BGS').style.background = 'url(https://zynga1-a.akamaihd.net/mwfb/mwfb/graphics/empire/london_hp_bg.png)  no-repeat'; 
			break;
			case 2:
				document.getElementById('BGS').style.background = 'url(https://zynga1-a.akamaihd.net/mwfb/mwfb/graphics/crafters_choice/hellish_hydraulics/popup_bg.jpg)  no-repeat'; 
				document.getElementById('BGS').style.backgroundSize = '100% 100%';
			break;
			case 3:
				document.getElementById('BGS').style.background = 'url(http://file1.hpage.com/004925/76/bilder/wallpaper-2.jpg)  no-repeat'; 
				document.getElementById('BGS').style.backgroundSize = '100% 100%';
			break;
			case 4:
				document.getElementById('BGS').style.background = 'url(http://file1.hpage.com/004925/76/bilder/wallpaper-1.jpg)  no-repeat'; 
				document.getElementById('BGS').style.backgroundSize = '100% 100%';
			break;
			case 5:
				document.getElementById('BGS').style.background = ''; 
				document.getElementById('BGS').style.backgroundColor = 'black'; 
				document.getElementById('BGS').style.backgroundSize = '';
			break;
			case 6:
				document.getElementById('BGS').style.background = 'url(https://zynga1-a.akamaihd.net/mwfb/mwfb/graphics/empire/losangeles_hp_bg.jpg)  no-repeat'; 
				document.getElementById('BGS').style.backgroundPosition = 'center center';
			break;
			case 7:
				document.getElementById('BGS').style.background = ''; 
				document.getElementById('BGS').style.backgroundColor = 'transparent'; 
				document.getElementById('BGS').style.backgroundSize = '';
			break;
		}
	};
	
	var BanditXPCheck = function(n){
		if (DroneX.Settings.BanditXPCheck != n){
			DroneX.Settings.BanditXPCheck = n;
		}
		writeSettings();
		switch(parseInt(n)){
			case 0:
				DroneX.Settings.BanditElapsedTimerXP = 4;
				break;
			case 1:
				DroneX.Settings.BanditElapsedTimerXP = 1;
				break;
			case 2:
				DroneX.Settings.BanditElapsedTimerXP = 2;
				break;
			case 3:
				DroneX.Settings.BanditElapsedTimerXP = 3;
				break;
		}
	};
   
	var BanditCSHCheck = function(n){
		if (DroneX.Settings.BanditCSHCheck != n){
			DroneX.Settings.BanditCSHCheck = n;
		}
		writeSettings();
		switch(parseInt(n)){
			case 0:
				DroneX.Settings.BanditElapsedTimerCash = 4;
				break;
			case 1:
				DroneX.Settings.BanditElapsedTimerCash = 1;
				break;
			case 2:
				DroneX.Settings.BanditElapsedTimerCash = 2;
				break;
			case 3:
				DroneX.Settings.BanditElapsedTimerCash = 3;
				break;
			case 4:
				DroneX.Settings.BanditElapsedTimerCash = 4;
				break;
		}
	};
   
	var BanditJOBCheck = function(n){
		if (DroneX.Settings.BanditJOBCheck != n){
			DroneX.Settings.BanditJOBCheck = n;
		}
		writeSettings();
	};	
		
	$('#BGC option:eq('+DroneX.Settings.BG+')').prop('selected', true);
	BGCheck(DroneX.Settings.BG);	
	
	$('#XPBanO option:eq('+DroneX.Settings.BanditXPCheck+')').prop('selected', true);
	BanditXPCheck(DroneX.Settings.BanditXPCheck);
   
	$('#CSHBanO option:eq('+DroneX.Settings.BanditCSHCheck+')').prop('selected', true);
	BanditCSHCheck(DroneX.Settings.BanditCSHCheck);
   
	$('#JOBBanO option:eq('+DroneX.Settings.BanditJOBCheck+')').prop('selected', true);
	BanditJOBCheck(DroneX.Settings.BanditJOBCheck);
	
//	$('#ADD_SA1JOB #SA_10_0').parent().parent().parent().parent().parent().parent().hide()
//	$('#ADD_SA1JOB #SA_10_3').parent().parent().parent().parent().parent().parent().hide()
//	$('#ADD_SA1JOB #SA_10_6').parent().parent().parent().parent().parent().parent().hide()
	$('#ADD_MEXJOB #MEX_10_2').parent().parent().parent().parent().parent().parent().hide() 
	$('#ADD_MEXJOB #MEX_10_4').parent().parent().parent().parent().parent().parent().hide() 
	$('#ADD_MEXJOB #MEX_10_7').parent().parent().parent().parent().parent().parent().hide()
	
	$('#DX_restartTime').val(DroneX.Settings.RestartTime);
	$('#DX_restartTime').change(function(){
		DroneX.Settings.RestartTime = parseInt(this.value);
		if(DroneX.Settings.RestartTime > 1){
			$('#ss').text('s');
		}else{
			$('#ss').text('');
		}
		writeSettings();
	}).trigger('change');
	
	$('#DX_bankAbove').val(DroneX.Settings.BankAbove);
	$('#DX_bankAbove').change(function(){
		DroneX.Settings.BankAbove = parseInt(this.value);
		writeSettings();
	}).trigger('change');
	
	$("#DX_disableNY").click(function(){
		if($(this).is(':checked')){
			DroneX.Settings.disableNYBank = true;
		}else{
			DroneX.Settings.disableNYBank = false;
		}
		writeSettings();
	})
	
	if(DroneX.Settings.disableNYBank){
		$('#DX_disableNY').prop('checked', true);
	}else{
		$('#DX_disableNY').prop('checked', false);
	}

/*	$("#DX_buyCityStore_10").click(function(){
		if($(this).is(':checked')){
			DroneX.Settings.buyCity10 = true;
		}else{
			DroneX.Settings.buyCity10 = false;
		}
		writeSettings();
	})
	
	if(DroneX.Settings.buyCity10){
		$('#DX_buyCityStore_10').prop('checked', true);
	}else{
		$('#DX_buyCityStore_10').prop('checked', false);
	}*/
	
	$("#DX_buyCityStore_11").click(function(){
		if($(this).is(':checked')){
			DroneX.Settings.buyCity11 = true;
		}else{
			DroneX.Settings.buyCity11 = false;
		}
		writeSettings();
	})
	
	if(DroneX.Settings.buyCity11){
		$('#DX_buyCityStore_11').prop('checked', true);
	}else{
		$('#DX_buyCityStore_11').prop('checked', false);
	}
	
	$("#DX_buyCityStore_12").click(function(){
		if($(this).is(':checked')){
			DroneX.Settings.buyCity12 = true;
		}else{
			DroneX.Settings.buyCity12 = false;
		}
		writeSettings();
	})
	
	if(DroneX.Settings.buyCity12){
		$('#DX_buyCityStore_12').prop('checked', true);
	}else{
		$('#DX_buyCityStore_12').prop('checked', false);
	}	
	
	$("#cLevelup").click(function(){
		if($(this).is(':checked')){
			DroneX.Settings.collectLevelUp = true;
		}else{
			DroneX.Settings.collectLevelUp = false;
		}
		writeSettings();
	})
	
	if(DroneX.Settings.collectLevelUp){
		$('#cLevelup').prop('checked', true);
	}else{
		$('#cLevelup').prop('checked', false);
	}
	
	$("#cPowerJob").click(function(){
		if($(this).is(':checked')){
			DroneX.Settings.PowerJob = true;
		}else{
			DroneX.Settings.PowerJob = false;
		}
		writeSettings();
	})
	
	if(DroneX.Settings.PowerJob){
		$('#cPowerJob').prop('checked', true);
	}else{
		$('#cPowerJob').prop('checked', false);
	}
	
	$('#DX_SpendxyzWhen').val(DroneX.Settings.SpendXYZWhen);
	
	$('#DX_SpendxyzWhen').change(function(){
		if(this.selectedIndex == 0) {
			$('#DX_skillsSpan').hide();
		}else {
			if(this.selectedIndex == 3){
				$('#DX_skillsAcq').show();
			}else{
				$('#DX_skillsAcq').hide();
			}
			$('#DX_skillsSpan').show();
		}
		DroneX.Settings.SpendXYZWhen = this.selectedIndex;
		writeSettings();
	}).trigger('change');
	
	$('#DX_Spendxyz').val(DroneX.Settings.SpendXYZ);
	
	$('#DX_Spendxyz').change(function(){
		DroneX.Settings.SpendXYZ = this.selectedIndex;
		writeSettings();
	}).trigger('change');
	
	
	$('#DX_spendxyzPoints').val(DroneX.Settings.spendxyzPoints);
	
	$('#DX_spendxyzPoints').change(function(){
		DroneX.Settings.spendxyzPoints = parseInt(this.value);
		writeSettings();
	}).trigger('change');
	
	$('#DX_spendxyzKeep').val(DroneX.Settings.spendxyzKeep);
	
	$('#DX_spendxyzKeep').change(function(){
		DroneX.Settings.spendxyzKeep = parseInt(this.value);
		writeSettings();
	}).trigger('change');
	

	$('#DX_noResources').val(DroneX.Settings.NoResources);
	
	$('#DX_noResources').change(function(){
		if(this.selectedIndex == 0) {
			$('#DX_restartSpan').hide();
		}else {
			$('#DX_restartSpan').show();
		}
		DroneX.Settings.NoResources = this.selectedIndex;
		writeSettings();
	}).trigger('change');
	
	$("#Dx_AutoStart").click(function(){
		if($(this).is(':checked')){
			DroneX.Settings.AutoStart = true;
		}else{
			DroneX.Settings.AutoStart = false;
		}
		writeSettings();
	})
	
	if(DroneX.Settings.AutoStart){
		$('#Dx_AutoStart').prop('checked', true);
		$('#DxAS').show();
		$('#DroneX_Tab_JobList').click();
		ClickGo = setTimeout(function(){autorunDx();},15000);
	}else{
		$('#Dx_AutoStart').prop('checked', false);
	}

	$('#DxAS').click(function(){
		clearTimeout(ClickGo);	
		$('#DxAS').hide();
		return false;
	})

	function autorunDx(){
		if (DroneX.Settings.AutoStart){
			$("#start").click()
		}else{
			return;
		}		
	}	
	
	$('#start').click(function(){	
		runTimeInterval = setInterval(runTimer, 1000);
		$('#DxAS').hide();
		clearTimeout(ClickGo);
		DroneX.Settings.isHiding = new Array();
		if(JobMap.length > 0){
			dolog('<span class="good"><font color="white">Checking Job Array..</font></span>')
			for(var i = 0; i < JobMap.length; i++){
				for(var j = 0; j < JobsAdded.length; j++){
					if(JobMap[i].isID == JobsAdded[j].isID && JobMap[i].isCity == JobsAdded[j].isCity){
						if(JobsAdded[j].counter < parseInt($('#JobCounter_'+JobMap[i].isCity+'_'+JobsAdded[j].isID).text())){
							JobsAdded[j].counter = parseInt($('#JobCounter_'+JobMap[i].isCity+'_'+JobsAdded[j].isID).text());
						}
						if(JobsAdded[j].isCost < parseInt(JobMap[i].isCost)){
							logit('JobsAdded[j].isCost < parseInt(JobMap[i].isCost)')
							JobsAdded[j].isCost = JobMap[i].isCost;
						}
						if(JobsAdded[j].isExp < parseInt(JobMap[i].isExp)){
							logit('JobsAdded[j].isExp < parseInt(JobMap[i].isExp)')
							JobsAdded[j].isExp = JobMap[i].isExp;
						}
						if(JobsAdded[j].isRatio < parseFloat(JobMap[i].isRatio)){
							JobsAdded[j].isRatio = JobMap[i].isRatio;
						}
						if(JobsAdded[j].isMastered != JobMap[i].isMastered){
							logit('JobsAdded[j].isMastered != JobMap[i].isMastered')
							JobsAdded[j].isMastered = JobMap[i].isMastered
						}
					}
				}
			}
		}else{
			dolog('<span class="good"><font color="white">Making Job Array..</font></span>')
		}
		JobMap = new Array();
		$('#customjobs li a').each(function(){
			if($(this).attr('id') == 'JobRatios' || $(this).attr('id') == 'JobEnergyTill'){
				return true;
			}
			//logit('id is: '+$(this).attr('id'))
			var Ratioing;
			var RatioingJobValue = '0.00';
			var NRGSwitch;
			var NRGSwitchValue;
			if($(this).parent().parent().parent().children().last().css('display') == 'none'){ //Ratioing is off ResourceSwitchingOn ResourceSwitchVal
				Ratioing = false;
			}else{
				Ratioing = true;
				var jrv = parseFloat($(this).parent().parent().parent().children().last().children('input').val());
				RatioingJobValue = jrv.toPrecision(3);
			}
			if($(this).parent().parent().parent().children().last().prev().css('display') == 'none'){ //NRGSwitch is off
				NRGSwitch = false;
			}else{
				NRGSwitch = true;
				NRGSwitchValue = parseInt($(this).parent().parent().parent().children().last().prev().children('input').val());
			}	
			var new_job;
			var isUsingStam;
			if(/(Gain The Cooperation|Double Cross And|Offer Restitution|Send Your Partner|Sabotage The Bull|Use His Death)/.test($(this).parent().parent().get(0).firstChild.nodeValue)){
				isUsingStam = true;
			}else{
				isUsingStam = false;
			}			
			var info = $(this).attr('id').split('_');
			var city = info[2];
			var district = 'D'+parseInt(info[3]);
			try{
				var job = parseInt(info[4]);
			}catch(noOneLikesRobbing){}
			//if()
			if(city == 'NY'){
				new_job = {isName: NYJobMap[district][job].isName, isID: NYJobMap[district][job].isJobID, isCost: 0, isTab: NYJobMap[district][job].isTab, isCity: NYJobMap[district][job].isCity, RatioSwitchingOn:Ratioing, RatioSwitchVal:RatioingJobValue, ResourceSwitchingOn:NRGSwitch, ResourceSwitchVal:NRGSwitchValue, isStam: isUsingStam, shortName: 'NY', counter: 0, isExp: 0, isRatio: 0, isMastered:false};
			}else if(city == 'BRL'){
				new_job = {isName: BRLJobMap[district][job].isName, isID: BRLJobMap[district][job].isJobID, isCost: 0, isTab: BRLJobMap[district][job].isTab, isCity: BRLJobMap[district][job].isCity, RatioSwitchingOn:Ratioing, RatioSwitchVal:RatioingJobValue, ResourceSwitchingOn:NRGSwitch, ResourceSwitchVal:NRGSwitchValue, isStam: isUsingStam, shortName: 'BRL', counter: 0, isExp: 0, isRatio: 0, isMastered:false};
			}else if(city == 'CHI'){
				new_job = {isName: CHIJobMap[district][job].isName, isID: CHIJobMap[district][job].isJobID, isCost: 0, isTab: CHIJobMap[district][job].isTab, isCity: CHIJobMap[district][job].isCity, RatioSwitchingOn:Ratioing, RatioSwitchVal:RatioingJobValue, ResourceSwitchingOn:NRGSwitch, ResourceSwitchVal:NRGSwitchValue, isStam: isUsingStam, shortName: 'CHI', counter: 0, isExp: 0, isRatio: 0, isMastered:false};
			}else if(city == 'LON'){
				new_job = {isName: LONJobMap[district][job].isName, isID: LONJobMap[district][job].isJobID, isCost: 0, isTab: LONJobMap[district][job].isTab, isCity: LONJobMap[district][job].isCity, RatioSwitchingOn:Ratioing, RatioSwitchVal:RatioingJobValue, ResourceSwitchingOn:NRGSwitch, ResourceSwitchVal:NRGSwitchValue, isStam: isUsingStam, shortName: 'LON', counter: 0, isExp: 0, isRatio: 0, isMastered:false};
			}/*else if(city == 'SA'){
				var properButton = SAJobMap[district][job].isJobID;
				var properName = SAJobMap[district][job].isName
				if(isUsingStam){
					properButton = StamJobs[job].isJobID;
					properName = StamJobs[job].isName;
				}
				new_job = {isName: properName, isID: properButton, isCost: 0, isTab: SAJobMap[district][job].isTab, isCity: SAJobMap[district][job].isCity, RatioSwitchingOn:Ratioing, RatioSwitchVal:RatioingJobValue, ResourceSwitchingOn:NRGSwitch, ResourceSwitchVal:NRGSwitchValue, isStam: isUsingStam, shortName: 'SA', counter: 0, isExp: 0, isRatio: 0, isMastered:false};
			}*/else if(city == 'MEX'){
				var properButton = MEXJobMap[district][job].isJobID;
				var properName = MEXJobMap[district][job].isName
				if(isUsingStam){
					properButton = StamJobs[job].isJobID;
					properName = StamJobs[job].isName;
				}			
				new_job = {isName: properName, isID: properButton, isCost: 0, isTab: MEXJobMap[district][job].isTab, isCity: MEXJobMap[district][job].isCity, RatioSwitchingOn:Ratioing, RatioSwitchVal:RatioingJobValue, ResourceSwitchingOn:NRGSwitch, ResourceSwitchVal:NRGSwitchValue, isStam: isUsingStam, shortName: 'MEX', counter: 0, isExp: 0, isRatio: 0, isMastered:false};
			}else if(city == 'LA'){
				new_job = {isName: LAJobMap[district][job].isName, isID: LAJobMap[district][job].isJobID, isCost: 0, isTab: LAJobMap[district][job].isTab, isCity: LAJobMap[district][job].isCity, RatioSwitchingOn:Ratioing, RatioSwitchVal:RatioingJobValue, ResourceSwitchingOn:NRGSwitch, ResourceSwitchVal:NRGSwitchValue, isStam: isUsingStam, shortName: 'LA', counter: 0, isExp: 0, isRatio: 0, isMastered:false};
			}else if(city == 'LTD'){
				var myparent = $('#customjobs #'+$(this).attr('id')).parent()[0].previousSibling;
				var ltdname = $(myparent).text();
				new_job = {isName:ltdname, isID:info[5], isTab:info[4], isCity:info[3], isCost: 0, RatioSwitchingOn:Ratioing, RatioSwitchVal:RatioingJobValue, ResourceSwitchingOn:NRGSwitch, ResourceSwitchVal:NRGSwitchValue, isStam: isUsingStam, shortName: 'SD', counter: 0, isExp: 0, isRatio: 0, isMastered:false};
			}
			var saving = {isInfo:$(this).attr('id'), isRatioOn: Ratioing, isRatioVal: RatioingJobValue, isNRGSwitchOn:NRGSwitch, isNRGValue:NRGSwitchValue};
			if(city == 'LTD'){
				var myparent = $('#customjobs #'+$(this).attr('id')).parent()[0].previousSibling;
				var ltdname = $(myparent).text();
				saving = {isCheatName:ltdname, isInfo:$(this).attr('id'), isRatioOn: Ratioing, isRatioVal: RatioingJobValue, isNRGSwitchOn:NRGSwitch, isNRGValue:NRGSwitchValue};
			}
			//ADD_LA1JOB LA_5_0 normal
							//LTD_11_141_1115 SD
			
			DroneX.Settings.isHiding.push(saving);
			JobMap.push(new_job);
		})
		writeSettings();
		if(JobMap.length < 1){
			alert('You must add at least one job');
			return;
		}
		if(JobsAdded.length < 1){
			logit('first time load is true!')
			JobsAdded = JobMap;
		}
		for(var i = 0; i < JobMap.length; i++){
			var inThere = false;
			for(var j = 0; j < JobsAdded.length; j++){
				if(JobMap[i].isID == JobsAdded[j].isID && JobMap[i].isCity == JobsAdded[j].isCity){
					if(parseInt(JobsAdded[j].counter) > JobMap[i].counter){
						JobMap[i].counter = JobsAdded[j].counter;
					}
					if(parseInt(JobsAdded[j].isCost) > JobMap[i].isCost){
						JobMap[i].isCost = JobsAdded[j].isCost;
					}
					if(parseInt(JobsAdded[j].isExp) > JobMap[i].isExp){
						JobMap[i].isExp = JobsAdded[j].isExp;
					}
					if(parseFloat(JobsAdded[j].isRatio).toPrecision(3) > JobMap[i].isRatio){
						JobMap[i].isRatio = JobsAdded[j].isRatio;
					}
					JobMap[i].isMastered = JobsAdded[j].isMastered
					inThere = true;
				}
			}		
			if(!inThere){
				JobsAdded.push(JobMap[i])
			}
		}
		$('#DroneX_Tab_Main').click();
		$('#DroneX_Tab_JobSetup .DroneX_TabMiddle').prepend(' <img src="https://zynga1-a.akamaihd.net/mwfb/mwfb/graphics/item_treasure_chest_key.gif" style="height:18px;width:18px;text-align:center;margin:-3px;">');
		$('#DroneX_Tab_JobList .DroneX_TabMiddle').prepend(' <img src="https://zynga1-a.akamaihd.net/mwfb/mwfb/graphics/item_treasure_chest_key.gif" style="height:18px;width:18px;text-align:center;margin:-3px;">');
		$('#DroneX_Tab_JobSetup').attr("title","Disabled!").addClass('gxDisabled');
		$('#DroneX_Tab_JobList').attr("title","Disabled!").addClass('gxDisabled');
		$('#start').hide();
		$('#stop').show();
		setTimeout(function(){grabInfoz();},1000);
		return false;
	});
	
	var JobMapCount = 0;

	function grabInfoz(){
		if(!isRunning){
			return;
		}
		dolog('Grabbing Requirements...', true);
		if(JobMapCount < JobMap.length){
			if(JobMap[JobMapCount].isCost == 0){
				$('#inAction').html('Grabbing Requirements for '+JobMap[JobMapCount].isName);//add3Dots(, 85)
				AjxRequestBuilder('xw_controller=travel&xw_action=travel&from=job&destination='+JobMap[JobMapCount].isCity+'&tab='+JobMap[JobMapCount].isTab, function(page){
					if(page.indexOf('ERROR 500: response never closed')!=-1){
						dolog('Zynga Error 500, retrying..', true)
						grabInfoz();
						return;
					}else if(/Complete more jobs to unlock/.test(page)){
						JobMap.splice(JobMapCount,1)
						dolog('<span class="bad">District not unlocked, removing from job list..</span>');
						if(JobMap.length < 1){
							dolog('<span class="bad">No other jobs in list, stopping..</span>');
							$('#stop').click();
							return;
						}
						setTimeout(function(){grabInfoz();},500);
					}else{
						var JobInfo;
						var energy; 
						var stamina;
						var exp;
						if(JobMap[JobMapCount].isCity == 1) {
							if(JobMap[JobMapCount].isTab == 1){
								JobInfo = $(page).find('#job_' + JobMap[JobMapCount].isID);
								energy = parseInt($(JobInfo).find('.energy').text()) || 0; 
								exp = parseInt($(JobInfo).find('.experience').text()) || 0;
								var MasteredSoFar = $(page).find('#job_'+JobMap[JobMapCount].isID).attr('class')
								if(/mastery_level_/.test(MasteredSoFar)){
									var isMasteredTo = parseInt(MasteredSoFar.match(/\d+$/)[0]);
									if(isMasteredTo == 3){
										JobMap[JobMapCount].isMastered = DroneX.Imgs.GoldStar;
									}else if(isMasteredTo == 2){
										JobMap[JobMapCount].isMastered = DroneX.Imgs.SilverStar;
									}else if(isMasteredTo == 1){
										JobMap[JobMapCount].isMastered = DroneX.Imgs.BronzeStar;
									}
								}else{
									JobMap[JobMapCount].isMastered = DroneX.Imgs.NoneStar;
								}
							}else{
								JobInfo = $(page).find('#city_job_' + JobMap[JobMapCount].isID);
								energy = parseInt($(JobInfo).find('.energy').text()) || 0; 
								exp = parseInt($(JobInfo).find('.experience').text()) || 0;
								try{
									var getmastery = $(page).find('#city_job_' + JobMap[JobMapCount].isID + ' > .job_name').text();
									if(/Level 3 Mastered/.test(getmastery)){
										//Gold mastery
										JobMap[JobMapCount].isMastered = DroneX.Imgs.GoldStar;
									}else if(/Level 2 Mastered/.test(getmastery)){
										//Silver mastery
										JobMap[JobMapCount].isMastered = DroneX.Imgs.SilverStar;
									}else{
										//Bronze mastery
										JobMap[JobMapCount].isMastered = DroneX.Imgs.BronzeStar;
									}
								}catch(none){
									logit('null mastery?');
									JobMap[JobMapCount].isMastered = DroneX.Imgs.GoldStar;
								}
							}
							stamina = 0;
						}else{
							JobInfo = $(page).find('#job-id-'+ JobMap[JobMapCount].isID);
							energy = parseInt($(JobInfo).find('li.energy:last').attr('current_value')) || 0; 
							stamina = parseInt($(JobInfo).find('li.stamina:last').attr('current_value')) || 0;
							exp = parseInt($(JobInfo).find('li.experience:last').attr('current_value'));
							try{
								var MasteredSoFar = $(page).find('#selected-district-mastery').attr('class');
								if(JobMap[JobMapCount].isCity < 10){
									MasteredSoFar = $(page).find('div[id^="brazil_district_'+JobMap[JobMapCount].isTab+'"]').attr('class');
								}
								if(parseInt(MasteredSoFar.match(/\d+$/)[0]) == 4){
									//ruby mastery
									JobMap[JobMapCount].isMastered = DroneX.Imgs.RubyStar;
								}else if(parseInt(MasteredSoFar.match(/\d+$/)[0]) == 3){
									//Gold mastery
									JobMap[JobMapCount].isMastered = DroneX.Imgs.GoldStar;
								}else if(parseInt(MasteredSoFar.match(/\d+$/)[0]) == 2){
									//Silver mastery
									JobMap[JobMapCount].isMastered = DroneX.Imgs.SilverStar;
								}else if(parseInt(MasteredSoFar.match(/\d+$/)[0]) == 1){
									//Bronze mastery
									JobMap[JobMapCount].isMastered = DroneX.Imgs.BronzeStar;
								}else{
									//None Star
									JobMap[JobMapCount].isMastered = DroneX.Imgs.NoneStar
								}
							}catch(none){
								logit('null mastery?');
								JobMap[JobMapCount].isMastered = DroneX.Imgs.RubyStar;
							}
						}
						var pool = (energy > 0 ? energy : stamina);
						JobMap[JobMapCount].isCost = parseInt(pool);
						JobMap[JobMapCount].isExp = parseInt(exp);
						JobMap[JobMapCount].isRatio = (JobMap[JobMapCount].isExp/JobMap[JobMapCount].isCost).toFixed(3);
						dolog('<span class="good"><font color="gold">Requirements found!</font></span>');
						setTimeout(function(){grabInfoz();},500);
					}
				}, function(){
					grabInfoz();
				});
				return;
			}else{
				JobMapCount++;
				setTimeout(function(){grabInfoz();},1000);
				return;
			}
		}
		//if(isFirstLoad){
			//isFirstLoad = false;
			document.getElementById('JobList').innerHTML = '';
			for(var i = 0; i < JobMap.length; i++){
				var GetName = parseStuff(JobMap[i].isName);
				JobMap[i].isName = GetName.name;
//				JobMap[i].isRatio = GetName.ratio;
					/*if(JobMap[i].isStam){
						document.getElementById('JobList').innerHTML += '<div style="width:500px;float:left;"><img title="Job Mastery" src="'+JobMap[i].isMastered+'">'+ add3Dots(JobMap[i].isName)+' ('+JobMap[i].isRatio+')</div><div style="width:80px;float:left;"> <img src="'+DroneX.Imgs.StaminaIcon+'">'+ JobMap[i].isCost+'</div> <div style="width:95px;float:left;"><img src="'+DroneX.Imgs.ExpIcon+'">'+JobMap[i].isExp+' </div><div style="width:35px;float:left;">x<span title="Amount of times this job has been attempted" id="JobCounter_'+JobMap[i].isID+'">0</span></div>';
					}else{
						document.getElementById('JobList').innerHTML += '<div style="width:500px;float:left;"><img title="Job Mastery" src="'+JobMap[i].isMastered+'">'+ add3Dots(JobMap[i].isName)+' ('+JobMap[i].isRatio+')</div><div style="width:80px;float:left;"> <img title="Job Costs" src="'+DroneX.Imgs.EnergyIcon+'">'+ JobMap[i].isCost+'</div> <div style="width:95px;float:left;"><img title="Job Pays" src="'+DroneX.Imgs.ExpIcon+'">'+JobMap[i].isExp+' </div><div style="width:35px;float:left;">x<span title="Amount of times this job has been attempted" id="JobCounter_'+JobMap[i].isID+'">0</span></div>';
					} */ //add3Dots()
				document.getElementById('JobList').innerHTML += '<div style="width:458px;float:left; font-weight: bold;"><img title="Job Mastery" src="'+JobMap[i].isMastered+'">'+ JobMap[i].isName+' ('+JobMap[i].isRatio+')</div><div style="width:43px;float:left; font-weight: bold;">'+JobMap[i].shortName+'</div><div style="width:77px;float:left; font-weight: bold;">'+ (JobMap[i].isStam == true ? '<img src="'+DroneX.Imgs.StaminaIcon+'">' : '<img title="Job Costs" src="'+DroneX.Imgs.EnergyIcon+'">') +JobMap[i].isCost+'</div>'+
				' <div style="width:96px;float:left; font-weight: bold;"><img src="'+DroneX.Imgs.ExpIcon+'">'+JobMap[i].isExp+' </div><div style="width:35px;float:left; font-weight: bold;">x<span title="Amount of times this job has been attempted" id="JobCounter_'+JobMap[i].isCity+'_'+JobMap[i].isID+'">'+JobMap[i].counter+'</span></div>';
			}
		setTimeout(function(){checkUserStats();},100);
	}
	
	function parseStuff(str) { // By Esa
		var re = /^(.*?)\(([0-9.]+)\)/
		var matches = str.match( re );
		if( matches && matches.length == 3 ) {
			return {
				name: matches[1],
				ratio: parseFloat(matches[2]).toFixed(3)
			}
		}
		return null;
	}	

	function add3Dots(string, cap){
		var dots = "...";
		var limit = 39;
		if(cap){
			limit = parseInt(cap);
		}
		/*if(/mwfb\/graphics/.test(string)){
 			logit('modding cap')
 			limit = 260;
		}*/ 
		if(/<span class/.test(string)){
 			logit('modding cap for class')
 			limit += 26;
		}
		if(/<font color/.test(string)){
 			logit('modding cap for font')
 			limit += 27;
		}
		if(string.length > limit){
			// you can also use substr instead of substring
			string = string.substring(0,limit) + dots;
		}
		return string;
	}
	
	var lastLevel = -1;
	var currentCity = 0;
	var currentTab = 0;
	var userInfo = {
		currentEnergy: 0,
		currentStamina: 0,
		currentLevel: 0,
		currentExp: 0,
		currentSkillPoints: 0
	};

	function checkUserStats(){
		if(!isRunning){
			return;
		}
		dolog('Checking Energy & Stamina..', true);
		$('#inAction').html('Checking Energy & Stamina..');
		AjxRequestBuilder('xw_controller=propertyV2&xw_action=createData&xw_city=10&tmp=&cb=&xw_person='+User.id.substr(2)+'&mwcom=1&city=10&xw_client_id=8',function(msg){
			//(/ERROR 500/i.test(msg))
			if(msg.indexOf('ERROR 500: response never closed') != -1){
				dolog('Zynga Error 500, retrying in 5 seconds..', true);
				setTimeout(function(){checkUserStats();},5000);
				return;
			}
			try{
				var data = JSON.parse(msg);
				userInfo.currentEnergy = parseInt(data.user_fields.user_energy);
				userInfo.currentStamina = parseInt(data.user_fields.user_stamina);
				userInfo.currentLevel = parseInt(data.user_fields.user_level);
				userInfo.currentExp = parseInt(data.user_fields.exp_to_next_level);
				userInfo.currentSkillPoints = parseInt(data.user_fields.user_skill)
				currentCombinedRatio = (userInfo.currentExp/(userInfo.currentEnergy+userInfo.currentStamina)).toFixed(3);
				currentCity = parseInt(data.user_fields.currentCityId);
				if(userInfo.currentLevel > lastLevel){
					lastLevel = userInfo.currentLevel;
					if(DroneX.Settings.collectLevelUp){
						grabLvlUp();
					}
				}
				if($('#DX_SpendxyzWhen').prop('selectedIndex') != 0 && !SkillSpendingInProgress){
					if($('#DX_SpendxyzWhen').prop('selectedIndex') == 3){
						if(userInfo.currentSkillPoints >= parseInt(DroneX.Settings.spendxyzPoints) && userInfo.currentSkillPoints > parseInt(DroneX.Settings.spendxyzKeep)){
							pointsToSpend = (userInfo.currentSkillPoints - parseInt(DroneX.Settings.spendxyzKeep))
							//logit('is not a number: '+isNaN(pointsToSpend))
							spendSkills();
						}
					}
				}
				$('#DroneX_stats').show()
			}catch(e){
				dolog('Error parsing JSON, retrying in 5 seconds..', true);
				setTimeout(function(){checkUserStats();},5000);
				return;
			}
			updateUserStats()
			dolog('<span class="good"><font color="white">You have </font><img src="https://zynga1-a.akamaihd.net/mwfb/mwfb/graphics/icon-energy.gif"> <font color="#fc3">'+userInfo.currentEnergy+' Energy,</font> <img src="https://zynga1-a.akamaihd.net/mwfb/mwfb/graphics/icon_stamina_16x16.png"> <font color="#fc3">'+userInfo.currentStamina+' Stamina,</font> <font color="#fc3">Level: '+userInfo.currentLevel+'</font></span>');
			decideNXTaction();
			//dolog('up to here!', true);
		}, function(fail){
			dolog('fail, retrying in 5 seconds..', true);
			setTimeout(function(){checkUserStats();},5000);
		});
	}
	
	function decideNXTaction(){
		if(!isRunning){
			return;
		}
		var can_job = false;
		for(var i = 0; i < JobMap.length; i++){
			if(JobMap[i].isStam && userInfo.currentStamina >= JobMap[i].isCost||!JobMap[i].isStam && userInfo.currentEnergy >= JobMap[i].isCost){
				can_job = true;			
			}
		}
		if(can_job) {
			selectJob();
		} else {
			if($('#DX_SpendxyzWhen').prop('selectedIndex') != 0 && !SkillSpendingInProgress){
				if($('#DX_SpendxyzWhen').prop('selectedIndex') == 2){
					if(userInfo.currentSkillPoints > parseInt(DroneX.Settings.spendxyzKeep)){
						pointsToSpend = (userInfo.currentSkillPoints - parseInt(DroneX.Settings.spendxyzKeep))
						//logit('is not a number: '+isNaN(pointsToSpend))
						spendSkills();
						return;
					}
				}
			}
			if(parseInt($('#DX_noResources').val()) == 1){
				var wait = (parseInt(DroneX.Settings.RestartTime)*60*1000);
				dolog('<span class="bad">Outta Energy & Stamina.. Restarting in '+DroneX.Settings.RestartTime+' minute'+(DroneX.Settings.RestartTime > 1 ? 's' : '')+'</span>', true);
				dolog('<span class="bad">Outta Energy & Stamina.. Restarting in '+DroneX.Settings.RestartTime+' minute'+(DroneX.Settings.RestartTime > 1 ? 's' : '')+'</span>');
				restartInterval = setTimeout(function(){checkUserStats();},wait)
			}else{
				dolog('<span class="bad">Outta NRG & Stamina</span>', true);
				$('#stop').click();
			}
//			dolog('<span class="bad">Outta NRG & Stamina</span>', true);
		}
	}
	
	function grabLvlUp(){
		dolog('Grabbing levelup..', true)
		if($('#DX_SpendxyzWhen').prop('selectedIndex') != 0 && !SkillSpendingInProgress){
		//	logit('in spend check')
		//	logit('index is: '+$('#DX_SpendxyzWhen').prop('selectedIndex'))
			if($('#DX_SpendxyzWhen').prop('selectedIndex') == 1){
			//	logit('sel index is 1')
				if(userInfo.currentSkillPoints > parseInt(DroneX.Settings.spendxyzKeep)){
					pointsToSpend = (userInfo.currentSkillPoints - parseInt(DroneX.Settings.spendxyzKeep))
				//	logit('is not a number: '+isNaN(pointsToSpend))
					spendSkills();
				}
			}
		}
		AjxRequestBuilder('html_server.php?xw_controller=levelUpBonus&xw_action=addBonusItem&xw_city=1&mwcom=1&no_load=1&xw_client_id=8', function(a){
			if(a.indexOf('ERROR 500: response never closed')!=-1){
				dolog('<span class="bad">Zynga Error 500, Levelup may of already been collected..</span>')
				return;
			} else {
				var data = JSON.parse(a.replace(/^(\s\d\s+)/,''));
				updateStats('Levelup');
				dolog('<span class="good">Level <font color="gold">'+data.user_fields.user_level+'</font> You received: <font color="gold">'+data.bonusName+'</font></span>');
				$('#LastLevelup').html('<span class="good">Level <font color="gold">'+data.user_fields.user_level+'</font> You received: <font color="gold">'+data.bonusName+'</font></span>');
				$('#levelup_log').prepend('<span class="good">Level <font color="gold">'+data.user_fields.user_level+'</font> You received: <font color="gold">'+data.bonusName+'</font></span><br>');
			}//add3Dots(, 96)
			ajxQueueCheckQueue();
		}, function(){
			grabLvlUp();
		});
	}
	
	var loot_item=[],l_log='',total_loot=0;

   function Add_to_loot(loot,count){
		total_loot+=count;
		if(loot_item.length <= 0){
			loot_item[loot_item.length]=new Array(loot,count);
		} else{
			for(i=0; i<loot_item.length; i++){
				if(loot == loot_item[i][0]){
						loot_item[i][1]+=count;
						break;
				}else if(i==loot_item.length-1){
						loot_item[loot_item.length]=new Array(loot,count);
						break;
				}
			}
		}
		//logit('loot is.. '+JSON.stringify(loot_item, null, 0));
		loot_item.sort();
		document.getElementById('loot_log').innerHTML = '';
		loot_item.reverse();
		try{
			l_log = '';
			for(l=(loot_item.length-1); l>=0; l--){
				l_log += '<span class="good">'+loot_item[l][1]+'x</span> <span class="good"><font color="white">#'+loot_item[l][0]+'</font></span><br>';
			}
			document.getElementById('loot_log').innerHTML = l_log;
		}catch(erra){alert(erra);}
	}	
	
	var timesToDoJob, timesJobDone, currentCombinedRatio, SwitchRatio, SwitchAmount;

	function selectJob(){
		if(!isRunning){
			return;
		}
		var i;
		jobArray = new Array();
		selectJobLoop:
		for(i = 0; i < JobMap.length; i++){
			var willLevel;
			if(JobMap[i].isStam && userInfo.currentStamina >= JobMap[i].isCost){
				timesToDoJob = parseInt(Math.floor(userInfo.currentStamina/JobMap[i].isCost));
				willLevel = timesToDoJob*JobMap[i].isExp;
				if(userInfo.currentExp - willLevel <= 0){
					timesToDoJob = parseInt(Math.ceil(userInfo.currentExp/JobMap[i].isExp));
				}
				extraStamLoop:
				for(var j = i; j < JobMap.length; j++){
					if(JobMap[j].RatioSwitchingOn){
						if(j != JobMap.length-1){
							if(currentCombinedRatio <= JobMap[j].RatioSwitchVal){
								if(JobMap[j+1].isStam && userInfo.currentStamina >= JobMap[j+1].isCost && currentCombinedRatio <= JobMap[j].RatioSwitchVal){
									continue selectJobLoop;
								}else if(userInfo.currentEnergy >= JobMap[j+1].isCost && currentCombinedRatio <= JobMap[j].RatioSwitchVal){
									continue selectJobLoop;
								}
							}
							if(JobMap[j+1].isStam && JobMap[j+1].isCost > userInfo.currentStamina || !JobMap[j+1].isStam && JobMap[j+1].isCost > userInfo.currentEnergy){
								if(JobMap[j+1].ResourceSwitchingOn){
									continue extraStamLoop;
								}else if(JobMap[j+1].RatioSwitchingOn){
									continue extraStamLoop;
								}
							}
							SwitchRatio = JobMap[j].RatioSwitchVal;
							var changeTime = parseInt(ratioPredict0rStamina(JobMap[j].isCost, JobMap[j].isExp));
							if(changeTime < timesToDoJob){
								timesToDoJob = changeTime;
								dolog('<span class="good"><font color="gold">Ratio predicted to change if job is done: x'+timesToDoJob+'</font></span>')
							}
							if(timesToDoJob < 1){
								timesToDoJob = 1;
							}
							break selectJobLoop;
						}else{
							break selectJobLoop;
						}
					}else if(JobMap[j].ResourceSwitchingOn){
						if(j != JobMap.length-1){
							if(userInfo.currentStamina <= JobMap[j].ResourceSwitchVal){
								if(JobMap[j+1].isStam && userInfo.currentStamina >= JobMap[j+1].isCost && userInfo.currentStamina <= JobMap[j].ResourceSwitchVal){
									continue selectJobLoop;
								}else if(userInfo.currentEnergy >= JobMap[j+1].isCost && userInfo.currentEnergy <= JobMap[j].ResourceSwitchVal){
									continue selectJobLoop;
								}
							}
							if(JobMap[j+1].isStam && JobMap[j+1].isCost > userInfo.currentStamina || !JobMap[j+1].isStam && JobMap[j+1].isCost > userInfo.currentEnergy){
								if(JobMap[j+1].ResourceSwitchingOn){
									continue extraStamLoop;
								}else if(JobMap[j+1].RatioSwitchingOn){
									continue extraStamLoop;
								}
							}
							SwitchAmount = JobMap[j].ResourceSwitchVal;
							var changeTime = parseInt(staminaPredict0r(JobMap[j].isCost));
							if(changeTime < timesToDoJob){
								timesToDoJob = changeTime;
								dolog('<span class="good"><font color="white">Stamina will be less than switch amount, if job is done: x'+timesToDoJob+'</font></span>')
							}
							if(timesToDoJob < 1){
								timesToDoJob = 1;
							}
							break selectJobLoop;
						}else{
							break selectJobLoop;
						}
					}else{
						break selectJobLoop;
					}
				}
			}else if(!JobMap[i].isStam && userInfo.currentEnergy >= JobMap[i].isCost){
				timesToDoJob = parseInt(Math.floor(userInfo.currentEnergy/JobMap[i].isCost));
				willLevel = timesToDoJob*JobMap[i].isExp;
				if(userInfo.currentExp - willLevel <= 0){
					timesToDoJob = parseInt(Math.ceil(userInfo.currentExp/JobMap[i].isExp));
				}
				extraLoop:
				for(var j = i; j < JobMap.length; j++){
					if(JobMap[j].RatioSwitchingOn){
						if(j != JobMap.length-1){
							if(currentCombinedRatio <= JobMap[j].RatioSwitchVal){
								if(JobMap[j+1].isStam && userInfo.currentStamina >= JobMap[j+1].isCost && currentCombinedRatio <= JobMap[j].RatioSwitchVal){
									continue selectJobLoop;
								}else if(userInfo.currentEnergy >= JobMap[j+1].isCost && currentCombinedRatio <= JobMap[j].RatioSwitchVal){
									continue selectJobLoop;
								}
							}
							if(JobMap[j+1].isStam && JobMap[j+1].isCost > userInfo.currentStamina || !JobMap[j+1].isStam && JobMap[j+1].isCost > userInfo.currentEnergy){
								if(JobMap[j+1].ResourceSwitchingOn){
									continue extraLoop;
								}else if(JobMap[j+1].RatioSwitchingOn){
									continue extraLoop;
								}
							}	
							SwitchRatio = JobMap[j].RatioSwitchVal;
							var changeTime = parseInt(ratioPredict0rEnergy(JobMap[j].isCost, JobMap[j].isExp));
							if(changeTime < timesToDoJob){
								timesToDoJob = changeTime;
								dolog('<span class="good"><font color="white">Ratio predicted to change if job is done: x'+timesToDoJob+'</font></span>')
							}
							if(timesToDoJob < 1){
								timesToDoJob = 1;
							}
							break selectJobLoop;
						}else{
							break selectJobLoop;
						}
					}else if(JobMap[j].ResourceSwitchingOn){
						if(j != JobMap.length-1){
							if(userInfo.currentEnergy <= JobMap[j].ResourceSwitchVal){								
								if(JobMap[j+1].isStam == true && userInfo.currentStamina >= JobMap[j+1].isCost && userInfo.currentStamina <= JobMap[j].ResourceSwitchVal){
									continue selectJobLoop;
								}else if(userInfo.currentEnergy >= JobMap[j+1].isCost && userInfo.currentEnergy <= JobMap[j].ResourceSwitchVal){
									continue selectJobLoop;
								}
							}
							if(JobMap[j+1].isStam && JobMap[j+1].isCost > userInfo.currentStamina || !JobMap[j+1].isStam && JobMap[j+1].isCost > userInfo.currentEnergy){
								if(JobMap[j+1].ResourceSwitchingOn){
									continue extraLoop;
								}else if(JobMap[j+1].RatioSwitchingOn){
									continue extraLoop;
								}
							}
							SwitchAmount = JobMap[j].ResourceSwitchVal;
							var changeTime = parseInt(energyPredict0r(JobMap[j].isCost));
							if(changeTime < timesToDoJob){
								timesToDoJob = changeTime;
								dolog('<span class="good"><font color="white">Energy will be less than switch amount, if job is done: x'+timesToDoJob+'</font></span>')
							}
							if(timesToDoJob < 1){
								timesToDoJob = 1;
							}
							break selectJobLoop;
						}else{
							break selectJobLoop;
						}
					}else{
						break selectJobLoop;
					}
				}
			}
		}
		jobArray[0] = JobMap[i];
		$('#inAction').html('<span class="good"><font color="white">Going to '+jobArray[0].isName+'..</font></span>');
		//dolog('');
		timesJobDone = 0;
		getJobTmpKey(jobArray[0].isCity, jobArray[0].isTab, jobArray[0].isID);
	}
	
	function energyPredict0r(isCost){
		var i;
		for(i = 1; i < Math.floor(userInfo.currentEnergy/parseInt(isCost)); i++){
			var futureEnergy = userInfo.currentEnergy - (parseInt(isCost)*i)
			if(futureEnergy <= SwitchAmount && futureEnergy > parseInt(isCost)){
				return 1*i;
			}
		}
	}	
	
	function staminaPredict0r(isCost){
		var i;
		for(i = 1; i < Math.floor(userInfo.currentStamina/parseInt(isCost)); i++){
			var futureStamina = userInfo.currentStamina - (parseInt(isCost)*i)
			if(futureStamina <= SwitchAmount && futureStamina > parseInt(isCost)){
				return 1*i;
			}
		}
	}

	function ratioPredict0rEnergy(isCost, isExp){
		var i;
		if(Math.floor(userInfo.currentEnergy/parseInt(isCost)) == 1){
			return 1;
		}else{
			for(i = 1; i < Math.floor(userInfo.currentEnergy/parseInt(isCost)); i++){
				var futureExp = userInfo.currentExp - (parseInt(isExp)*i)
				var futureEnergy = userInfo.currentEnergy - (parseInt(isCost)*i)
				var futureRatio = (futureExp/(futureEnergy+userInfo.currentStamina)).toFixed(3);
				if(futureRatio <= SwitchRatio && futureEnergy >= parseInt(isCost)){
					return 1*i;
				}
			}
		}
		return i;
	}	
	
	function ratioPredict0rStamina(isCost, isExp){
		var i;
		if(Math.floor(userInfo.currentStamina/parseInt(isCost)) == 1){
			return 1;
		}else{
			for(i = 1; i < Math.floor(userInfo.currentStamina/parseInt(isCost)); i++){
				var futureExp = userInfo.currentExp - (parseInt(isExp)*i)
				var futureStamina = userInfo.currentStamina - (parseInt(isCost)*i)
				var futureRatio = (futureExp/(futureStamina+userInfo.currentEnergy)).toFixed(3);
				if(futureRatio <= SwitchRatio && futureStamina >= parseInt(isCost)){
					return 1*i;
				}
			}
		}
		return i;
	}	
	
	var jobTempKey, mexbossURL;
	
	function getJobTmpKey(a, b, c){
		if(!isRunning){
			return;
		}
		var JobInfo;
		var loadedJobEnergy;
		var loadedJobStamina;
		var loadedExp;
		var resourcePool;
		currentTab = 0;
		currentCity = 0;
		//$('#inAction').html('Getting job tmp key..')
		dolog('Getting job tmp key..', true)
		AjxRequestBuilder('xw_controller=travel&xw_action=travel&xw_city=10&from=job&zone=1&destination='+a+'&tab='+b, function(msg){
			var x;
			try{
				if(jobArray[0].isCity == 1){
					if(jobArray[0].isTab == 1){
						x = /tmp=(.*?)&/.exec($(msg).find('#job_'+c+' > .do_job').attr('href'))[1];
						JobInfo = $(msg).find('#job_' + c);
						loadedJobEnergy = parseInt($(JobInfo).find('.energy').text()) || 0; 
						loadedExp = parseInt($(JobInfo).find('.experience').text()) || 0;
					}else{
						x = /tmp=(.*?)&/.exec($(msg).find('#city_job_'+c+' > .job_action > a').attr('href'))[1];
						JobInfo = $(msg).find('#city_job_' + c);
						loadedJobEnergy = parseInt($(JobInfo).find('.energy').text()) || 0; 
						loadedExp = parseInt($(JobInfo).find('.experience').text()) || 0;
					}
					loadedJobStamina = 0;
					var tabURL = $(msg).find('ul[id^="jobs_bar"]').find('.tab_on').children().children().attr('href');
					try{
						currentTab = parseInt(/tab=(\d+)&/.exec(tabURL)[1]);
					}catch(pahtab1){currentTab = 1;}
					
				}else{
					x = /tmp=(.*?)&/.exec($(msg).find('#btn_dojob_'+c).attr('href'))[1];
					JobInfo = $(msg).find('#job-id-'+ c);
					loadedJobEnergy = parseInt($(JobInfo).find('li.energy:last').attr('current_value')) || 0; 
					loadedJobStamina = parseInt($(JobInfo).find('li.stamina:last').attr('current_value')) || 0;
					loadedExp = parseInt($(JobInfo).find('li.experience:last').attr('current_value'));
					banditInfo.crewMembers = parseInt($(msg).find('#btn_queue').text().substring(2));
					$(msg).find('div[id^="brazil_district_"]').each(function(index){
						if($(this).attr('style') == "display: block;"){
							currentTab = parseInt($(this).attr('district_id'));
						}
					})
				}	
				if(jobArray[0].isCity == 11){
					if(/ACTIVE/.test($(msg).find('#boss-district-job-top-hud').find('.details').text())){
						logit('boss is active!')
						mexbossURL = '&ba=1';
					}
				}else{
					mexbossURL = '';
				}
				currentCity = parseInt(/xw_city.*?(\d+)/.exec(msg)[1]);
				if(currentCity == 0||currentTab == 0){
					logit('current city/tab is 0'+currentCity +','+currentTab)
					return;
				}
			}catch(notmp){
				dolog('job tmp key not found! stopping..', true)
				return;
			}
			jobTempKey = x;
			logit('job tmp key is: '+jobTempKey)
			resourcePool = (loadedJobEnergy > 0 ? loadedJobEnergy : loadedJobStamina);
			if(resourcePool != jobArray[0].isCost||jobArray[0].isExp != loadedExp){
				if(isNaN(resourcePool)||isNaN(loadedExp)){
					//do nothing... ya know!
				}else{
					for(var i = 0; i < JobMap.length; i++){
						if(JobMap[i].isID == jobArray[0].isID && JobMap[i].isCity == jobArray[0].isCity){
							JobMap[i].isCost = resourcePool;
							JobMap[i].isExp = loadedExp;
						}
					}
					dolog('Energy1|Stamina Reqs have changed rechecking jobs..');
					decideNXTaction();
					return;
				}
			}
			setTimeout(function(){err404 = 1;},3500);
			cashInHand = 0;
			doJob();
		}, function(fail){getJobTmpKey(a, b, c);})
	}	
	
	var lastJobWasPwr = false;
	var cashInHand = 0;

	function doJob(info){
		if(!isRunning){
			return;
		}
		$('#inAction').html('Doing Job '+ jobArray[0].isName+' x'+timesToDoJob)
		dolog('Doing Job..', true);
		var wasPwrJob = 0;
		var stopReason = false;
		var stopClick = false;
		var jobLog = '';
		if(info){
			//if(DroneX.Settings.PowerJob){
			//	logit('info is.. '+JSON.stringify(info, null, 0));
			//}
			m=[];
			try{
				userInfo.currentEnergy = parseInt(/user_energy.*?(\d+)/.exec(info)[1]);
				userInfo.currentStamina = parseInt(/user_stamina.*?(\d+)/.exec(info)[1]);
				userInfo.currentLevel = parseInt(/user_level.*?(\d+)/.exec(info)[1]);
				userInfo.currentExp = parseInt(/exp_to_next_level.*?(\d+)/.exec(info)[1]);
				userInfo.currentSkillPoints = parseInt(/user_skill.*?(\d+)/.exec(info)[1]);				
				cashInHand = parseInt(/user_cash.*?(\d+)/.exec(info)[1]);
				currentCombinedRatio = (userInfo.currentExp/(userInfo.currentEnergy+userInfo.currentStamina)).toFixed(3);
			}catch(reload){
				logit('Reload page info possibily.. '+JSON.stringify(info, null, 0));
				if(info.indexOf('top.location.href =') > 0){
					dolog('<span class="bad">Refresh MW Reload Code is detected..</span>', true);
					dolog('<span class="bad">Refresh MW Reload Code is detected..</span>');
					return;
				}
			}
			updateUserStats();
			if(userInfo.currentLevel > lastLevel){
				lastLevel = userInfo.currentLevel;
				if(DroneX.Settings.collectLevelUp){
					grabLvlUp();
				}
			}
			if($('#DX_SpendxyzWhen').prop('selectedIndex') != 0 && !SkillSpendingInProgress){
				if($('#DX_SpendxyzWhen').prop('selectedIndex') == 3){
					if(userInfo.currentSkillPoints >= parseInt(DroneX.Settings.spendxyzPoints) && userInfo.currentSkillPoints > parseInt(DroneX.Settings.spendxyzKeep)){
						pointsToSpend = (userInfo.currentSkillPoints - parseInt(DroneX.Settings.spendxyzKeep))
						//logit('is not a number: '+isNaN(pointsToSpend))
						spendSkills();
					}
				}
			}
			if(jobArray[0].isStam && userInfo.currentEnergy == 0){
				dolog('<span class="bad">Need 1 energy to do a stamina job.. Zynga coding fail..</span>', true);
				dolog('<span class="bad">Need 1 energy to do a stamina job.. Zynga coding fail..</span>');
				setTimeout(function(){doJob();},3500);
				return;
			}
			if(/session has timed out/.test(info)){
				dolog('has timed out..');
				stopClick = true;
			}else if(/do not have enough cash/.test(info)){
				dolog('not enough cash..');
				stopClick = true;
			}else if(/do not have enough Energy/.test(info)){
				dolog('not enough energy..');
				stopReason = true;
			}else if(/do not have enough Stamina/.test(info)){
				dolog('not enough stamina..');
				stopReason = true;
			}else if(/changed cities in another/.test(info)){
				dolog('You have changed cities in another window. Travel back and then continue..');
				stopClick = true;
			}else if (/Error while loading page from/.test(info)) {
				dolog('Mafia Wars overloaded...');
				stopClick = true;
			}else if (/You need the following items for this job/.exec(info)){
				dolog('You need the following items for this job.');
				stopClick = true;
			}else if (/You need more cash to buy these items/.exec(info)){
				dolog('You need more cash to buy these items.');
				stopClick = true;
			}else if (/You don't have the necessary items/.test(info)){
				dolog('Missing items to repeat job');
				stopClick = true;
			}else if (m=/You don't have enough (.*?) for this job/.exec(info)){
				dolog('Need more '+m[1]+' to complete job.');
				stopClick = true;
			}else if (/These loot drops are needed for this job/.exec(info)){
				dolog('Need consumables to do job, stopping');
				stopClick = true;
			}else if (m=/You need .* Energy/.test(info)){
				dolog('Outta energy.');
				stopReason = true;
			}else if (/to take this job/.test(info)){
				dolog('Outta energy.');
				stopReason = true;
			}else if (/index_controller/.test(info)) {
				dolog('Session timed out, reloading job page...');
				stopClick = true;
			}
			if(stopClick){
				$('#stop').click();
				return;
			}else if(stopReason){
				if(banditInfo.banditsActive){
					banditInfo.banditsActive = false;
					$('#banditAppeared').parent().hide();
					if(banditInfo.Bandit_type == "XP Bandit" && banditInfo.crewMembers > 0){
						AjxRequestBuilder(banditInfo.Bandit_elim, function (response){checkUserStats();});
						return;
					}
				}
				setTimeout(function (){checkUserStats();},1000);
				return;
			}
			if(jobArray[0].isCity == 1){
				if(jobArray[0].isTab == 1){
					timesJobDone++;
					jobLog += '<span class="good">Job done!</span>';
					updateStats('JobCounter_'+jobArray[0].isCity+'_'+jobArray[0].isID);
				}else if(/: Completed/.test(info)) {
					timesJobDone++;
					jobLog += '<span class="good">Job done!</span>';
					updateStats('JobCounter_'+jobArray[0].isCity+'_'+jobArray[0].isID);
					var e = parseInt(/(\d+).*?Experience/.exec(info)[1]);
					var en = /(\d+) Energy/.exec(info);
					var m=[];
					if (/As a Top Mafia Wheelman/.test(info)) {
						jobLog += ' <span class="good"><font color="white"><img src="http://mwfb.static.zgncdn.com/mwfb/graphics/icon-energy.gif"> Wheelman bonus!</font></span>'; //
					}
					if (/As a Top Mafia Mastermind/.test(info)) {
						jobLog += ' <span class="good"><font color="white"><img src="http://mwfb.static.zgncdn.com/mwfb/graphics/icon_experience_16x16_01.gif"> Mastermind bonus!</font></span>';//
					}
					if (/As a Top Mafia Bagman/.test(info)) {
						jobLog += ' <span class="good"><font color="white"><img src="http://mwfb.static.zgncdn.com/mwfb/graphics/icon_cash_16x16_01.gif"> Bagman bonus!</font></span>';//
					}
					var money='';
					var jobmoney=0;
					money = '<span class="good">'+$(info).find('.message_cash .money').text().trim()+'</span>';
					jobLog += ' <span class="good"><font color="white">Gained </font></span><span class="good">'+e+'</span> <font color="white">exp! and </font></span>'+money;
					
					var regex = /You (earned|gained):? (some|a|an) (.+?)\./g;
					var loot = '';
					while((m = regex.exec(info)) != null) {
						if (!loot) {
							loot = ' <img src="https://zynga1-a.akamaihd.net/mwfb/mwfb/graphics/icon_loot_16x16_01.gif"> Loot: ';
						}
						//logit('item id: '+$(info).find('.item_with_preview').attr('item_id'))
						loot += m[3]+', ';
					}
					if (m=/You (earned|gained):? (\d+) (.+?)\./.exec(info)) {
						if (!loot) {
							loot = ' <img src="https://zynga1-a.akamaihd.net/mwfb/mwfb/graphics/icon_loot_16x16_01.gif"> Loot: ';
						}
					//	logit('2 item id: '+$(info).find('.item_with_preview').attr('item_id'))
						loot += m[2]+'x '+m[3]+', ';
						Add_to_loot(m[3], parseInt(m[2]))
					}
					if(loot != ''){
						jobLog += ' <span class="good"><font color="white">'+loot+'</font></span>';//
					} 
				}
			}else{
				if(typeof info == 'object'|| /Current Page: job_controller/.test(info)){
					var object = info;
					/*if(ENjobCity == 11){
						var bossStatus = $(object).find('#boss-district-job-top-hud').find('.details').text();
						if(/INACTIVE/.test(bossStatus)){
							logit('boss inactive..')
							mexbossURL = '';
						}else if(/RECRUITED/.test(bossStatus)){
							logit('boss recruited..')
							mexbossURL = '';
						}else if(/ACTIVE/.test(bossStatus)){
							logit('boss is active!')
							mexbossURL = '&ba=1';
						}
						
					}*/
				}
				else{
					var object = jQuery.parseJSON(info.replace(/^(\s\d\s+)/,''));
				}
				if(Util.isset(object.jobResult)){
					timesJobDone++;
					jobLog += '<span class="good">Job done!</span>'; 
					updateStats('JobCounter_'+jobArray[0].isCity+'_'+jobArray[0].isID);
					try{
						wasPwrJob = parseInt(/batchCount.*?(\d+)/.exec(info)[1]) || 0;
						if(wasPwrJob > 0){
							jobLog += ' <span class="good"><font color="white">Did powerjob x'+wasPwrJob+'!</font></span>';
							timesJobDone = timesJobDone+9;
							updateStats('JobCounter_'+jobArray[0].isCity+'_'+jobArray[0].isID, 9);
						}
					}catch(none){}
					var jobResult = object.jobResult;
					
					if(jobResult.extraData.bonusCash > 0){
						jobResult.cash += parseInt(jobResult.extraData.bonusCash);
						jobLog += ' <span class="good"><font color="white"><img src="http://mwfb.static.zgncdn.com/mwfb/graphics/icon_cash_16x16_01.gif"> Bagman bonus!</font></span>';//
					}
					if(jobResult.extraData.bonusExperience > 0){
						jobResult.experience += jobResult.extraData.bonusExperience;
						jobLog += ' <span class="good"><font color="white"><img src="http://mwfb.static.zgncdn.com/mwfb/graphics/icon_experience_16x16_01.gif"> Mastermind bonus!</font></span>';//
					}
					if(jobResult.energy == 0 && jobResult.stamina == 0){
						jobLog += ' <span class="good"><font color="white"><img src="http://mwfb.static.zgncdn.com/mwfb/graphics/icon-energy.gif"> Wheelman bonus!</font></span>';//
					}
					
					var cash = 0;
					if (jobResult.cash > 0) {
						cash = '<span class="good">$'+commas(parseInt(jobResult.cash))+'</span>';
					}
					if (jobResult.cashUsed > 0) {
						cash = '<span class="good"><font color="white">spent</font></span> <span class="bad">-$'+commas(parseInt(jobResult.cashUsed))+'</span>';
					}
					
					jobLog += ' <span class="good"><font color="white">Gained </font></span><span class="good">'+jobResult.experience+'</span> <span class="good"><font color="white">exp! and </font></span>'+cash;
					
					var loot = '';
					var lootid = false;
					if(Util.isset(jobResult.loot)){
						if(jobResult.loot.length > 0){
							jobLog += ' <span class="good"><font color="white"><img src="https://zynga1-a.akamaihd.net/mwfb/mwfb/graphics/icon_loot_16x16_01.gif"> Looted:';
							for (var x = 0; x < jobResult.loot.length; x++) {
								if (lootid = /item_id=.?"(\d+).?"/.exec(jobResult.loot[x])) {
									lootid = lootid[1];
								}
								Add_to_loot(lootid, 1)
								loot += ' #'+lootid;
							}
							jobLog += loot+'!</font></span>';//<img src="https://zynga1-a.akamaihd.net/mwfb/mwfb/graphics/icon_loot_16x16_01.gif"> 
//							var lootID = parseInt(/item_id.*?(\d+)/.exec(jobResult.loot)[1])
						}
					}
					
					if(jobResult.lootBandit.length > 0){
						//banditInfo.banditsActive = true;
						banditInfo.Bandit_type = $(jobResult.lootBandit[0].markup).find('.bandit-desc:first').html();
						banditInfo.Bandit_elim = 'xw_controller=Job&xw_action=eliminateBandit&xw_city='+jobArray[0].isCity+'&stage='+jobArray[0].isTab+'&job='+jobArray[0].isID;
						banditInfo.Bandit_timer = parseInt(/time_left: ([\d]+),/.exec(jobResult.lootBandit[0].markup)[1]);
						if(banditInfo.Bandit_timer > 60){
							banditInfo.Bandit_timer = banditInfo.Bandit_timer/60;
						}else{
							banditInfo.Bandit_timer = 1;
						}
						logit('b timer is: '+banditInfo.Bandit_timer)
						if(!banditInfo.banditsActive){
							banditInfo.banditsActive = true;
							$('#banditAppeared').parent().show();
							$('#banditAppeared').html(banditInfo.Bandit_type+' Active')
							jobLog += ' <span class="good">"Found a '+banditInfo.Bandit_type+'!</span>';
						}
						if(banditInfo.crewMembers == 0){
							dolog('<span class="bad">Not Killing '+banditInfo.Bandit_type+'... Because no Crew!</span>');
							dolog('<span class="bad">Waiting out '+banditInfo.Bandit_type+'.. Restarting in 5 minutes...</span>');
							banditInfo.banditsActive = false;
							$('#banditAppeared').parent().hide(); 
							setTimeout(function(){checkUserStats();},60*1000*5);
							return;
						}else if(banditInfo.Bandit_type == "Job Bandit"){
							if(document.getElementById("JOBBanO").selectedIndex < 1){
								dolog('<span class="bad">Attempting to Kill '+banditInfo.Bandit_type+'...</span>');
								AjxRequestBuilder(banditInfo.Bandit_elim, function (response){doJob();})
								banditInfo.banditsActive = false;
								$('#banditAppeared').parent().hide(); 
								return;
							}else{
								dolog('<span class="bad">Not Killing '+banditInfo.Bandit_type+'... </span>', true);
								banditInfo.banditsActive = false;
								$('#banditAppeared').parent().hide(); 
								setTimeout(function(){checkUserStats();},60*1000*5);
								return;
							}
						}else if(banditInfo.Bandit_type == "Cash Bandit"){
							if(document.getElementById("CSHBanO").selectedIndex < 1 || banditInfo.Bandit_timer <= DroneX.Settings.BanditElapsedTimerCash) {
								dolog('<span class="bad">Attempting to Kill '+banditInfo.Bandit_type+'...</span>', true);
								banditInfo.banditsActive = false;
								$('#banditAppeared').parent().hide(); 
								AjxRequestBuilder(banditInfo.Bandit_elim, function (response){doJob();})
								return;
							}
						}else if(banditInfo.Bandit_type == "XP Bandit"){
							if(document.getElementById("XPBanO").selectedIndex < 1 || banditInfo.Bandit_timer <= DroneX.Settings.BanditElapsedTimerXP || userInfo.currentEnergy < jobArray[0].isCost) {
								dolog('<span class="bad">Attempting to Kill '+banditInfo.Bandit_type+'...</span>', true);
								banditInfo.banditsActive = false;
								$('#banditAppeared').parent().hide(); 
								AjxRequestBuilder(banditInfo.Bandit_elim, function (response){doJob();})
								return;
							}
						}
					}
				}
				
				if(Util.isset(object.data)){
					jobLog += '<span class="bad">job failed...</span>';
					//logit('reason 2.. '+JSON.stringify(object, null, 0));
					if(Util.isset(object.data.impulseBuy)){
						if(object.data.impulseBuy.success == 1){
							dolog($(object.data.impulseBuy.message).text());
						}else {
							if(/You need the following items for this job/.test(object.data.impulseBuy.message)){
								dolog('you need to buy items')
							}else if(/You do not have enough cash to do this job/.test(object.data.impulseBuy.message)){
								dolog('You do not have enough cash to do this job.')
							}else if(/These loot drops/.test(object.data.impulseBuy.message)){
								dolog('Need consumables..')
							}else if(/(not_enough_energy|You do not have enough energy|not_enough_stamina|You do not have enough stamina)/i.test(object.data.impulseBuy.message)){
								dolog('Ran out of energy/stamina.')
							}else {
								dolog(object.data.impulseBuy.message);
							}
						}
						if(banditInfo.banditsActive){
							logit('Panic stations!! Bandit elim! failsafe!!')
							$('#banditAppeared').parent().hide(); 
							AjxRequestBuilder(banditInfo.Bandit_elim, function (response){doJob();});
						}
						return;
					}else if(Util.isset(object.data.success)){
						logit('success was false...')
					}
				}
				if(jobArray[0].isCity != 10 && jobArray[0].isTab != 10 && !banditInfo.banditsActive){
					var resourcePool = (jobResult.energy > 0 ? jobResult.energy : jobResult.stamina);
					if(resourcePool != jobArray[0].isCost||jobArray[0].isExp != jobResult.experience){
						if(isNaN(resourcePool)||isNaN(jobResult.experience)){
							//do nothing... ya know!
						}else if(resourcePool == 0){
							//do nothing.. again!
						}else{
							for(var i = 0; i < JobMap.length; i++){
								if(JobMap[i].isID == jobArray[0].isID && JobMap[i].isCity == jobArray[0].isCity){
									JobMap[i].isCost = resourcePool;
									JobMap[i].isExp = jobResult.experience;
								}
							}
							
						//	logit('rePool is: '+resourcePool);
						//	logit('jobxp is: '+jobResult.experience);
							logit('stuff changed what? '+JSON.stringify(info, null, 0))
							dolog('Energy2|Stamina Reqs have changed rechecking jobs..');
							decideNXTaction();
							return;
						}
					}
				}
				
			} 
			dolog(jobLog); //add3Dots(,250)
		}
		if(timesJobDone > timesToDoJob-1){
			//dolog('job done x'+(timesJobDone-1))
			if(banditInfo.banditsActive){
				banditInfo.banditsActive = false;
				$('#banditAppeared').parent().hide();
				if(banditInfo.Bandit_type == "XP Bandit" && banditInfo.crewMembers > 0){
					AjxRequestBuilder(banditInfo.Bandit_elim, function (response){checkUserStats();});
					return;
				}
			}
			if(DroneX.Settings.BankAbove > 9){
				if (cashInHand > 10) {
					if($('#DX_disableNY').is(':checked') && jobArray[0].isCity == 1){
						//banking disabled in NY
					}else{
						dolog('<span class="good">Attempting the Banking..</span>');
						setTimeout(function (){banker();},100);
						return;
					}
				}
			}
			setTimeout(function (){decideNXTaction();},1000);
			//setTimeout(function (){checkUserStats();},1000);
		}else{
			dolog('<span class="good"><font color="gold">Attempting Job..</font></span>', true);
			var delay1 = 15000;
			var delay2 = 10;
			var reqUrl = 'html_server.php?xw_controller=job&xw_action=dojob&xw_city='+jobArray[0].isCity+'&tmp='+jobTempKey+'&tab='+jobArray[0].isTab+'&job='+jobArray[0].isID+''+mexbossURL;
			if(jobArray[0].isCity == 1 && jobArray[0].isTab == 1){
				reqUrl = 'html_server.php?xw_controller=story&xw_action=dojob&xw_city='+jobArray[0].isCity+'&tmp='+jobTempKey+'&tab='+jobArray[0].isTab+'&job='+jobArray[0].isID+'&no_load=1';
			}else if(DroneX.Settings.PowerJob){ //i like if statements...
			//	logit('power job is active..')
				if(jobArray[0].isCity == 10 && jobArray[0].isTab == 10){
				//	logit('city 10 tab 10..')
					if(timesToDoJob-timesJobDone >= 10){
					//	logit('can do job more than 10x.. '+(timesToDoJob-timesJobDone))
						var canDo = false;
						if(!jobArray[0].isStam && jobArray[0].isCost*10 <= userInfo.currentEnergy){
							canDo = true;
						}else if(jobArray[0].isCost*10 <= userInfo.currentStamina){
							canDo = true;
						}
					//	logit('can do is: '+canDo)
						if(canDo){
							delay1 = 15000
							delay2 = 4200;
							lastJobWasPwr = true;
							reqUrl = 'html_server.php?xw_controller=job&xw_action=doPowerJob&xw_city=10&tmp='+jobTempKey+'&tab=10&job='+jobArray[0].isID+''+mexbossURL;
						}
					}else{
						if(lastJobWasPwr){
							lastJobWasPwr = false;
							delay1 = 15000;
							delay2 = 4200;
						}else{
							delay1 = 15000;
							delay2 = 10;
						}
					}
				}
			}
			setTimeout(function(){AjxRequestBuilder(reqUrl, function(a){doJob(a);}, function(b){doJob();}, delay1);},delay2);
			
		}
	}	
	
	var userId = /sf_xw_user_id': '(.+)'/.exec(document.body.innerHTML)[1];

	function unix_timestamp() {
		return parseInt(new Date().getTime().toString().substring(0, 10));
	}
	
	function noimg(data) {
		return data.replace(/<img/g,'<noimg');
	}

	function banker() {
		if(!isRunning){
			return;
		}
		var num = 'x';
		var price;
	/*	if($('#DX_buyCityStore_10').is(':checked') && jobArray[0].isCity == 10){
			cityBuyIn = 10;
			price = 135;
			itemID = 24882;
			num = parseInt(Math.floor(cashInHand / price));
		}else */if($('#DX_buyCityStore_11').is(':checked') && jobArray[0].isCity == 11){
			cityBuyIn = 11;
			price = 108;
			itemID = 27296;
			num = parseInt(Math.floor(cashInHand / price));
		}else if($('#DX_buyCityStore_12').is(':checked') && jobArray[0].isCity == 12){
			cityBuyIn = 12;
			price = 225;
			itemID = 31451;
			num = parseInt(Math.floor(cashInHand / price));
		}
		if(num == 0){
			dolog('<span class="bad">Not enough cash to buy citystore items</span>');
			setTimeout(function (){decideNXTaction();},100);
			return;
		}else if(num != 'x'){
			dolog('<span class="good"><font color="white">Attempting to buy citystore items...</font></span>');
			var numafter = parseInt(num * price);
			AjxRequestBuilder('xw_controller=item&xw_action=view&xw_city='+jobArray[0].isCity+'&xw_person='+User.id+'&mwcom=1&tab=5',function(msg) {
				$msg=$(noimg(msg));
				var url=$msg.find('#itemBuy_'+itemID).attr('action');
				var params= {
					'ajax':1,
					'numBuy':num,
					'item':itemID,
					'tab':5,
					'sf_xw_user_id':User.id,
					'sf_xw_sig':local_xw_sig 	
				};
				AjxRequestBuilder(url, function(buyresponse) {
					dolog('<span class="good">'+$(noimg(buyresponse)).find('.message_body >div:first').text()+'</span>');
						setTimeout(function(){decideNXTaction();},100);
					}, function(errorResponse) {
						setTimeout(function(){jobChecker();},100);
					}, '', params
				)
			}, function(error) {
					setTimeout(function(){banker();},100);
			});
			return;		
		}else{
			var url = MW_BASE_URL+'/remote/html_server.php?xw_controller=bank&xw_action=deposit'+($('#DX_disableNY').is(':checked')?'_all':'');
		}
		User.clicks++;
		var params = {
			'ajax': 1,
			'sf_xw_user_id': User.id,
			'sf_xw_sig': local_xw_sig,
			'liteload': 1,
			'cb': userId+unix_timestamp(),
			'xw_client_id': 8,
			'skip_req_frame': 1,
			'amount': cashInHand,
			'xw_city': jobArray[0].isCity,
			'xw_person': User.id.substr(2),
			'clicks': User.clicks
		};
		AjxRequestBuilder(url, function (bankresponse) {
			var bankobject = jQuery.parseJSON(bankresponse.replace(/^(\s\d\s+)/,''));
			var message = '';
			if (Util.isset(bankobject.deposit_message)) {
				if (/bank can only hold/.test(bankobject.deposit_message)) {
					//New York bank is full
					dolog('<span class="bad">'+bankobject.deposit_message+'</span>');
					//if(!$('#ZX_buyCityStore').is(':checked')){
						//dolog('Bank is full, turning on citystore buying...');
					//	$('#ZX_buyCityStore').prop('checked', true);
					//}
				}
				else {
					var banked = $(bankobject.deposit_message).find('span.money:last').html() || '';
					var money = parseInt(banked.replace(/[^0-9]/g, ''));
					var message = bankobject.deposit_message+' <span class="more_in">(Balance: '+bankobject.bank_balance+')</span>';
					dolog('<span class="good">'+message+'</span>');
				}
			}
			if (Util.isset(bankobject.success_message)) {
				if (/You cannot deposit any more/.test(bankobject.success_message)) {
					// Vault full = 'You cannot deposit any more'
				//	if(!$('#ZX_buyCityStore').is(':checked')){
				//		$('#ZX_buyCityStore').prop('checked', true);
				//	}
				}
				dolog('<span class="good">'+bankobject.success_message+'</span>');
			}
			setTimeout(function(){decideNXTaction();},100);
		}, function(error) {
			setTimeout(function(){banker();},100);
		}, '', params)
	}
	
	function AjxRequestBuilder(urllink, handler, errorhandler, plug, extra){
		if(!isRunning){
			return;
		}
		var zserver = /\/\/(.*)\.mafiawars/.exec(document.location.href)[1];
		if(urllink.indexOf('html_server.php') >= 0){
			urllink = urllink.substr(urllink.indexOf('?')+1);
		}
		User.clicks++;
		var preurl = '//'+zserver+'.mafiawars.zynga.com/mwfb/remote/html_server.php?';
		var params = {
			'ajax': 1,
			'liteload': 1,
			'sf_xw_user_id': User.id,
			'sf_xw_sig': local_xw_sig,
			'xw_client_id': 8,
			'skip_req_frame': 1,
			'clicks': User.clicks
		};
		if(extra){
			params = extra;
		}
		var pull = 60000;
		if(plug){
			pull = parseInt(plug)
		}
		var ajxreq = {
			type: "POST",
			url: preurl+urllink,
			data: params,
			cache: false,
			timeout: pull,
			sst: parseInt((new Date()).getTime()),
			successFunction: handler,
			errorFunction: errorhandler
		};
		ajxreq.success = function (resp){
			req_active--;
			if(resp.status == 404||resp.length == 0){
				err404++;
				if(err404 > 3){
					err404 = 0;
					dolog('<span class="bad">Too many 404 errors detected! waiting 30 seconds..</span>');
					var that = this;
					setTimeout(function(){AjxRequestBuilder(that.url, that.successFunction, that.errorFunction)},30000);
					return;
				}else{
					dolog('<span class="bad">error detected! Resending URL..</span>')
					AjxRequestBuilder(this.url, this.successFunction, this.errorFunction)
					return;					
				}
			}else{
				err404 = 0;
				if(resp.indexOf('top.location.href =') > 0){
					dolog('<span class="bad">Refresh MW Reload Code is detected..</span>', true);
					dolog('<span class="bad">Refresh MW Reload Code is detected.. stopping..</span>');
					return;
				}
				//var SRT = (parseInt((new Date()).getTime()) - this.sst)
			//	logit('Server response time: '+SRT)
				//if(SRT > 1500){
				//	lag =+ lag + (SRT - 1500)
				//}
				this.successFunction(resp);
			}
		};
		ajxreq.error = function (badResp){
			req_active--;
			if(badResp.status == 404||badResp.length == 0){
				err404++;
				if(err404 > 3){
					err404 = 0;
					dolog('<span class="bad">Too many 404 errors detected! waiting 30 seconds..</span>');
					var that = this;
					setTimeout(function(){AjxRequestBuilder(that.url, that.successFunction, that.errorFunction)},30000);
					return;
				}else{
					dolog('<span class="bad">error detected! Resending URL..</span>')
					AjxRequestBuilder(this.url, this.successFunction, this.errorFunction)
					return;
				}
			}else{
				err404 = 0;
				if(badResp.status == 0){
					dolog('<span class="bad">Request Failed.. Retrying..</span>');
				} 
				//var SRT = (parseInt((new Date()).getTime()) - this.sst)
				//logit('Server response time: '+SRT)
				//if(SRT > 1500){
				//	lag =+ lag + (SRT - 1500)
				//}
				this.errorFunction(badResp);
			}
		};
		ajxreqs.push(ajxreq);
		ajxQueueCheckQueue();
	}

	function ajxQueueCheckQueue(){
		if(!isRunning){
			return;
		}
		if(!ajxreqs.length){
			return;
		}
		while (ajxreqs.length && req_active < 2){
			req_active++;
			var linkRequested = ajxreqs.shift();
			$.ajax(linkRequested);
		}
	}	
	
	var DroneLog = [];

	function dolog(msg, status){
		if(status){
			$('#status').html(msg);//add3Dots(, 98)
			if(minDiv){
				$('#hiddenStatus').html(add3Dots(msg, 39));
				
			}
		}else{
			DroneLog.unshift(msg);//add3Dots(msg, 88)
			var LogCount = DroneLog.length;
			var limit = parseInt($('#log_size').val());
			DroneLog.length = (LogCount < limit) ? LogCount: limit;
			document.getElementById('log').innerHTML = '';
			var LogEntry = '';
			for (LogCount = 0; LogCount < DroneLog.length; LogCount++) {
				LogEntry += DroneLog[LogCount] + '<br>'
			}
			$('#log').html(LogEntry);
		}
	}

	function commas(s) {
		while (d=/(-)?(\d+)(\d{3}.*)/.exec(s)) {
			s = (d[1]?d[1]+d[2]+','+d[3]:d[2]+','+d[3]);
		}
		return s;
	}
	
	function runTimer(){
		if(hours < 10){
			hourSpan = '0';
		}else{
			hourSpan = '';
		}
		if(minutes < 10){
			minutesSpan = '0';
		}else{
			minutesSpan = '';
		}
		if(seconds < 10){
			secondsSpan = '0';
		}else{
			secondsSpan = '';
		}
		seconds++;
		if(seconds > 59){
			minutes++
			seconds = 0;
		}
		if(minutes > 59){
			hours++;
			minutes = 0;
		}
		if(hours > 0){
			$('#rTime').html('Runtime: <span id="hourSpan">'+hours+' hour'+(hours > 1 ? 's' : '')+'</span> & <span id="minutesSpan">'+minutes+' minute'+(minutes > 1||minutes < 1 ? 's' : '')+'</span> & <span id="secondsSpan">'+seconds+' second'+(seconds > 1 ? 's' : '')+'</span>');
		}else{
			$('#rTime').html('Runtime: <span id="minutesSpan">'+minutes+' minute'+(minutes > 1||minutes < 1 ? 's' : '')+'</span> & <span id="secondsSpan">'+seconds+' second'+(seconds > 1||seconds < 1 ? 's' : '')+'</span>');
		}
	}	
	
	function spendSkills(){
		//logit('at spend skills')
		SkillSpendingInProgress = true;
		queSpendSkills();
	}

	function queSpendSkills(){
		//logit('at que skills')
		if($('#DX_SpendxyzWhen').selectedIndex == 0||!SkillSpendingInProgress||!isRunning){
			SkillSpendingInProgress = false;
			return;
		}
	//	logit('after 1 if')
		//if(userInfo.currentSkillPoints > parseInt(DroneX.Settings.spendxyzKeep)){
		//	logit('modding skills  to spend')
		//}
		pointsToSpend = (userInfo.currentSkillPoints - parseInt(DroneX.Settings.spendxyzKeep));
		//logit('spendy is: '+ pointsToSpend)
		//return;
		//logit('after 2 if')
		//logit('points to spend: '+pointsToSpend)
		if(pointsToSpend <= 0){
		//	logit('points to spend: '+pointsToSpend)
			SkillSpendingInProgress = false;
			dolog('<span class="good"><font color="white">All Skillpoints Applied! Kept: <font color="#fc3">'+DroneX.Settings.spendxyzKeep+'</font> Skillpoints</font></span>')
			ajxQueueCheckQueue();
			if($('#DX_SpendxyzWhen').prop('selectedIndex') == 2){
				checkUserStats();
			}  
		}else{
		//	logit('in else..')
			var skillURL = 'html_server.php?xw_controll	er=stats&xw_action=upgrade&xw_city=12&upgrade_key=';
			var upgradeType, upgradeTypeName, howMany;
		//	logit('before switch..')
			switch (parseInt($('#DX_Spendxyz').val())){
				case 0:  
					upgradeType = 'attack';
					upgradeTypeName = 'Attack';
				break;
				case 1:  
					upgradeType = 'defense';
					upgradeTypeName = 'Defense';
				break;
				case 2:  
					upgradeType = 'max_health';
					upgradeTypeName = 'Health';
				break;
				case 3:  
					upgradeType = 'max_energy';
					upgradeTypeName = 'Energy';
				break;
				case 4:  
					upgradeType = 'max_stamina';
					upgradeTypeName = 'Stamina';
				break;
				default: 
					upgradeType = 'nogo';
					upgradeTypeName = '';
			//	break;
			}
		//	logit('after switch')
			if(upgradeType == 'nogo'){
				logit('upgrade type couldnt be switched..')
				return;
			}
			if(pointsToSpend%100 == 0){
				skillURL += upgradeType+'&upgrade_amt=100';
				howMany = 100+' Skillpoints';
			}else if(pointsToSpend%25 == 0){
				skillURL += upgradeType+'&upgrade_amt=25';
				howMany = 25+' Skillpoints';
			}else if(pointsToSpend%5 == 0){
				skillURL += upgradeType+'&upgrade_amt=5';
				howMany = 5+' Skillpoints';
			}else{
				skillURL += upgradeType+'&upgrade_amt=1';
				howMany = 1+' Skillpoint';
			}
			skillURL += '&no_load=1&source=level_up_popup'
		//	logit('before send..')
			AjxRequestBuilder(skillURL, function(msg) {
				try{
					userInfo.currentSkillPoints = parseInt(/user_skill.*?(\d+)/.exec(msg)[1]);
					if(userInfo.currentSkillPoints == 0){
						setTimeout(function (){queSpendSkills();},1000);
					}else{
						dolog('<span class="good">Applied <font color="gold">'+howMany+'</font> to:</span> <font color="gold">'+upgradeTypeName+'</font>');
						setTimeout(function (){queSpendSkills();},1000);
					}
				}catch(errz){
					dolog('<span class="bad">Failed Applying Skillpoints! Retrying in 5 Seconds...</span>')
					setTimeout(function (){queSpendSkills();},5000);
				}
			}, function(error) {
					setTimeout(function(){queSpendSkills();},100);
			});
		}
	}
	
	function updateStats(stats_div, multiple){
		var multi = 1;
		if(multiple){
			multi = parseInt(multiple);
		}
		$('#'+stats_div).text(parseInt($('#'+stats_div).text()) + multi);
	}
	
	function updateUserStats(){
		/*
		userInfo.currentEnergy = parseInt(data.user_fields.user_energy);
				userInfo.currentStamina = parseInt(data.user_fields.user_stamina);
				userInfo.currentLevel = parseInt(data.user_fields.user_level);
				userInfo.currentExp = parseInt(data.user_fields.exp_to_next_level);
				currentCombinedRatio = (userInfo.currentExp/(userInfo.currentEnergy+userInfo.currentStamina)).toFixed(3);
				currentCity = parseInt(data.user_fields.currentCityId);
		$('#user_max_energy').text() = Zangano.resourceInfo.currentEnergy;
			document.getElementById('user_stamina')*/
		var enGot = Math.floor((userInfo.currentEnergy/parseInt($('#user_max_energy').text()))*100);
		var enNot = (100-enGot);
		var staGot = Math.floor((userInfo.currentStamina/parseInt($('#user_max_stamina').text()))*100);
		var staNot = (100-staGot);
		
		var statsDiv = '<div title="Energy" style="display: inline-block;height: 23px;vertical-align: top;"><span class="energy">'+userInfo.currentEnergy+'/'+$('#user_max_energy').text()+' </span>&nbsp;<span class="more_in" style="font-size: 12px;font-weight: bold;vertical-align: 1px;" title="Energy to XP">['+((userInfo.currentExp/userInfo.currentEnergy).toFixed(3) > 9 ? '>9' : (userInfo.currentExp/userInfo.currentEnergy).toFixed(3)) +']</span><br><span style="display:block;width:'+enGot+'%;height:2px;background-color:rgb(255,204,51);float:left;"></span><span style="display:block;width:'+enNot+'%;height:2px;background-color:rgba(255,204,51,0.35);float:right;"></span></div>'+
		'<span> </span>'+
		'<div title="Stamina" style="display: inline-block;height: 23px;vertical-align: top;"><span class="stamina">'+userInfo.currentStamina+'/'+$('#user_max_stamina').text()+' </span>&nbsp;<span class="more_in" style="font-size: 12px;font-weight: bold;vertical-align: 1px;" title="Stamina to XP">['+((userInfo.currentExp/userInfo.currentStamina).toFixed(3) > 9 ? '>9' : (userInfo.currentExp/userInfo.currentStamina).toFixed(3))+']</span><br><span style="display:block;width:'+staGot+'%;height:2px;background-color:rgb(255,165,0);float:left;"></span><span style="display:block;width:'+staNot+'%;height:2px;background-color:rgba(255,165,0,0.35);float:right;"></span></div>'

		$('#DroneX_stats').html(statsDiv+' <img style="vertical-align: middle;" title="Combined Energy & Stamina to XP" src="'+DroneX.Imgs.En2xp+'"><span class="more_in"> ['+currentCombinedRatio+']</span> - '+locationInfo[currentCity].name)
	}

	function writeSettings(){
		localStorage.setItem("DX_BG", JSON.stringify(DroneX.Settings));
	}
 
	function readSettings(){
		if (!localStorage.getItem("DX_BG")) { //no settings
			writeSettings();
		} else {
			var tempsettings = JSON.parse(localStorage.getItem("DX_BG"));
			if(Object.keys(tempsettings).length != Object.keys(DroneX.Settings).length) { 
				logit('stuff in save isnt right length!')
				writeSettings();
			}else{
				DroneX.Settings = tempsettings;
			}
		}
	}
	
	function loadCustomJobList(){
		for(var i = 0; i < DroneX.Settings.isHiding.length; i++){
			var temp = DroneX.Settings.isHiding[i].isInfo.split('_');
			if(temp[1] == 'FOBJOB'){
				$('#ADD_FOBJOB #'+DroneX.Settings.isHiding[i].isInfo.substring(11)).click();
			}else if(temp[2] == 'LTD'){
				//do nothing cause i have to do some techical stuff to implement this in
				if(SecretDistrictCounter > 0){
					//[{"isInfo":"LTD_9_135_1052","isRatioOn":false,"isRatioVal":"0.00","isNRGSwitchOn":false},
					for (var ii = 0; ii < SecretDistrictCounter; ii++) {
						if(SDMap[ii].isTab === DroneX.Settings.isHiding[i].isInfo.substring(12).split('_')[2]){
							//ADD_LA1JOB LA_5_0 normal
							//LTD_11_141_1115 SD
							$('#customjobs').append($('<li style="clear:both;list-style-type: none;height:36px;"></li>').html('<span style="background: none repeat scroll 0 0 #111111;border: 1px solid #333333;height: 24px;width:524px;float:left;"> '+DroneX.Settings.isHiding[i].isCheatName+' <span style="float:right;margin:3px;"><a href="#" class="clearitem" id="'+DroneX.Settings.isHiding[i].isInfo+'">X</a></span></span><a title="Add/Remove Energy Options" id="JobEnergyTill"><img src="https://zynga1-a.akamaihd.net/mwfb/mwfb/graphics/inventory/NAV/Inventory-wishlist-icon.png" style="margin:7px;"></a><a title="Add/Remove Ratio Options" id="JobRatios"><img src="https://zynga1-a.akamaihd.net/mwfb/mwfb/graphics/v3/target_daily_take_icon.png" style="margin:4px;"></a><span style="display:none; background: none repeat scroll 0 0 #111111;border: 1px solid #333333;height: 24px;width:330px;float:left;">Change to next job when energy is under:<input type="integer" style="resize:none;width:50px;" value="0"></span><span style="display:none; background: none repeat scroll 0 0 #111111;border: 1px solid #333333;height: 24px;width:291px;float:left;">Change to next job when ratio is under:<input type="integer" style="resize:none;width:30px;" value="0.00"></span>'));
						}
					}
				}
			}else{
				$('#ADD_'+DroneX.Settings.isHiding[i].isInfo.split('_')[1]+' #'+DroneX.Settings.isHiding[i].isInfo.substring(11)).click();
			}
			if(DroneX.Settings.isHiding[i].isRatioOn){
				$('#customjobs li span span #'+DroneX.Settings.isHiding[i].isInfo).parent().parent().parent().children().last().css('display', 'block')
				$('#customjobs li span span #'+DroneX.Settings.isHiding[i].isInfo).parent().parent().parent().children().last().children('input').val(DroneX.Settings.isHiding[i].isRatioVal)
			}else if(DroneX.Settings.isHiding[i].isNRGSwitchOn){
				$('#customjobs li span span #'+DroneX.Settings.isHiding[i].isInfo).parent().parent().parent().children().last().prev().css('display', 'block')
				$('#customjobs li span span #'+DroneX.Settings.isHiding[i].isInfo).parent().parent().parent().children().last().prev().children('input').val(DroneX.Settings.isHiding[i].isNRGValue)
			}
		}
	}loadCustomJobList();	
	
	
	/*add analytics*/
	function loadContent(file) {
		var head=document.getElementsByTagName('head').item(0);
		var scriptTag=document.getElementById('loadScript');
		if(scriptTag)head.removeChild(scriptTag);
		script=document.createElement('script');
		script.src=file;
		script.type='text/javascript';
		script.id='loadScript';
		head.appendChild(script);
		setTimeout(load,1000);
	}
	loadContent('https://www.google-analytics.com/ga.js');
	function load() {
		try {
			var pageTracker=_gat._getTracker("UA-35022618-1");
			pageTracker._trackPageview("/DX BG v09");
		} catch(err){}
	}
	/*end analytics*/		
//})();